Skip to content

Enhancement proposal: Better way to not accept redirecting links #2013

@Ravlen

Description

@Ravlen

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/false so that it will always follow redirects even when not in the accept array (would still use max_redirects to prevent loops). When true it displays the final destination in the output?
  • Alternatively, how about a reject array, then we could add [301, 308] or similar, which would mark redirects as rejected without needing to drop max_redirects to 0? This would rely on it knowing to output the final destination even when in the reject array.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions