Stack Exchange staff has a tool which can search and replace strings in the URLs, see Shog9's answer here: How to find and/or change a set of hyperlinks on a site? This tool is sometimes used when some domain which is often linked from some Stack Exchange site changes their structure.
I think it would be nice if this tool could also:
- Check whether some of the new URLs (after the modification) returns 404 error.
- Return the list of original and modified URLs.
- Return the list of the posts that were influenced.
If many posts are changed at once, it is possible that there might be some mistakes or that some of the pages from the old domain were transformed in a different way. Checking whether the new links work correctly would be useful. Having the list of the links could also be helpful in verifying whether the mass replacement did not cause some mistakes. (From what I understood, this bulk replacement tool was modified not too long ago in such a way that it is possible to run it networkwide rather than per site - although I have only seen this mentioned in comments. If the tool is used on multiple sites, this just increases the possibility that there might be some mistake and increases the importance of checking the new links.)
This can be considered as a follow-up to this question: Does the bulk replacement tool also check if the new link is working? There I asked whether this is already available; the answer was that it currently is not, so I made this into a feature request.
So far when suggesting such a replacement, I did my best to verify whether the links work already before the replacement. Typically what I did was:
- Getting the bodies of posts with matching URLs using SEDE.
- Downloaded the results of the query.
- Manipulated the results so that I isolated URLs. (I have used sed+grep, but I am sure there are more suitable tools for that.)
- After getting the list of links, I have modified them in the suggested ways.
- Then I tested the new links. (I did it using wget - there are certainly many tools for that.)
Although I only did this on one site (or a few sites) - if the replacement was done networkwide, this is getting a bit more complicated.
I suppose that something similar could be done even after the replacement. Moreover, I could also look (in SEDE or in the profile) on the activity of the Community user around the time when the links were being replaced. For example, here is a (single-site) query based on Glorfindel's suggestions.
The main point probably is that if the list of posts (or links) is created when this tool is run anyway - or if the tool can be easily modified to create such list - then getting the list directly from the bulk replacement tool would be more reliable (and much easier).