-
-
Notifications
You must be signed in to change notification settings - Fork 192
Open
Description
We're using this great tool to look for redirecting links in our docs, because we want to update them to the latest destinations. it's also a good way to prevent broken links in the long run, as redirecting links might suddenly become dead links.
The way we do this is with max_redirects = 0, then we get errors in the list like:
[301] https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.4 | Rejected status code (this depends on your "accept" configuration): Moved Permanently
This does work well for us, as it generates a list of links to review and update. The downside is that this does not show the final destination. If I set max_redirects = 5 and also set it to verbose with -v, I can get the information I seek:
[200] https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.4 | Redirect: Followed 1 redirect resolving to the final status of: OK. Redirects: https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.4 --> https://learn.microsoft.com/en-us/powershell/scripting/install/install-powershell-on-windows?view=powershell-7.4
So my proposal is to find a way to improve how this works to find redirecting links.
- How about a setting like
always_follow_redirects = true/falseso that it will always follow redirects even when not in theacceptarray (would still usemax_redirectsto prevent loops). Whentrueit displays the final destination in the output? - Alternatively, how about a
rejectarray, then we could add[301, 308]or similar, which would mark redirects as rejected without needing to dropmax_redirectsto0? This would rely on it knowing to output the final destination even when in therejectarray.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels