15

One of the sites which people reference on Buddhism.SE is Piya Tan's "Dharmafarers".

The URLs of reference material on that site have changed, for example:

  • Old: http://dharmafarer.org/wordpress/wp-content/uploads/2009/12/5.16-Dependent-arising-piya.pdf
  • New: http://www.themindingcentre.org/dharmafarer/wp-content/uploads/2009/12/5.16-Dependent-arising-piya.pdf

The old URLs no longer work (and aren't redirected automatically).

They did implement this automatic redirection (301 Moved Permanently) ...

... but that doesn't appear to work for the Wordpress resource files (wp-content/uploads).


So, what tools can you recommend, to find a set hyperlinks -- e.g. all hyperlnks on Buddhism.SE which begin with http://dharmafarer.org/?

And is there any tool to edit these automatically i.e. in bulk?

7
  • 3
    You can use the url: search opton: buddhism.stackexchange.com/… which gives 471 posts atm.
    – rene
    Jul 27, 2018 at 9:30
  • Thank you. That would be a lot to edit manually.
    – ChrisW
    Jul 27, 2018 at 9:32
  • For an semi-automatic approach see tex.meta.stackexchange.com/a/7326/36296 Jul 27, 2018 at 10:18
  • @samcarter So the "semi-automatic approach" was: 1) SEDE to get links; 2) browser to get content-to-be-edited; 3) emac+lisp to edit the content and to put edited text back into the O/S clipboard; 4) paste from clipboard into browser, and post.
    – ChrisW
    Jul 27, 2018 at 10:26
  • I guess it may be possible to edit using the StackExchange API these days?
    – ChrisW
    Jul 27, 2018 at 10:37
  • Yes, using the API for this would work. (A good rule of thumb is: if it's possible (manually) via the Stack Exchange app, it's possible via the API.)
    – Glorfindel Mod
    Aug 12, 2018 at 10:18
  • 1
    Related: Can the mass-replacement tool also replace and remove? As Yaakov Ellis noted in a comment, "the url replace tool that we use is a strict (case-sensitive) find-replace. No wildcards, no regex (by design)."
    – V2Blast
    Feb 4, 2022 at 23:40

1 Answer 1

22

There exists, internally, a search-and-replace tool for rewriting links. It's very simple; if someone changes their entire URL scheme, it's not much help. But for stuff like this, where we can simply cut out one consistent part of each URL and drop in another... It works pretty well.

If you need this - and I'd consider anything over 100 links a need - post a feature-request on the appropriate site meta and we'll try & get it done.

For more complicated rewrites, you should also post a meta discussion: assuming folks agree on what needs to be done, it's trivially possible to script (as Glorfindel suggests) or even just crowd-source it.

4
  • Was this tool used for rewriting HTTP links to HTTPS? In other words, is the Community user the one who makes these edits? Aug 14, 2018 at 22:34
  • 1
    There's a similar tool available for doing stuff like this cross-site, @Sonic; AFAIK that was used for the HTTP->HTTPS rewrite.
    – Shog9
    Aug 14, 2018 at 22:51
  • 1
    @Sonic yes, it is a script (written by Oded as far as I remember, as he fixed the bugs), which performs non-bumping edits and contributes the edits to the Community user. Aug 15, 2018 at 10:16
  • 1
    When Microsoft changed their URLs from docs.microsoft.com to learn.microsoft.com, it was mass-edited without creating an edit that is visible in the edit history.
    – riQQ
    May 16, 2023 at 17:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .