-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document order of redirects (recently created are matched first) #8309
Comments
Hi, this is kind of expected, since page redirects will redirect the same file in all versions (where the page leads to a 404). So for https://docs.pytest.org/en/reorganize-docs/mark.html it first redirects to https://docs.pytest.org/en/reorganize-docs/how-to/mark.html (page redirect), and then it redirects to https://docs.pytest.org/en/6.2.x/how-to/mark.html (exact redirect). I think you could solve this by using another exact redirect instead of a page redirect, so only the given version is redirected, not all versions.
We only use redirects when the page leads to a 404. |
Ah, I see, thanks. I didn't consider that redirects could be applied the other way around, this way it makes total sense. This won't be a problem anymore as soon as we get out our next major release (soon™), then we can redirect I wonder if it'd make sense to do exact redirects before page redirects? Though I'm assuming there's some other use-case I'm not thinking about this would break... |
You could look into file based redirects like https://github.com/wpilibsuite/sphinxext-rediraffe where it does redirects alongside your git history. |
Yeah, we may have some users depending on this behavior. But actually looks like the order comes from the creation date of the redirects, we should document that. A future improvement would be to allow users to change the order like we do with automation rules. |
This will be solved with #10881. Redirects will now have an explicit order that users can change. |
Details
A long while ago, we had a
reorganize-docs
branch. Those outdated docs were around for a long time (partially due to us forgetting the branch, partially due to #8264). Thus, it would be great to keep those links working. To do so, I added an exact redirect:So far, everything works as expected. Going to en/reorganize-docs/index.html will lead to en/6.2.x/index.html.
Now we're trying to restructure our documentation based on the Divio model. In the process, various pages moved, e.g. en/6.2.x/mark.html is now en/latest/how-to/mark.html.
To keep things working even if people link to the old location with
/latest
, we added page redirects:This works great: en/6.2.x/mark.html continues to work and doesn't get redirected (probably because RTD is clever enough to know that the page in fact exists there), while en/latest/mark.html is correctly redirected to en/latest/how-to/mark.html.
So far for the prologue, now on to the problem:
Expected Result
With those two redirects in place, en/reorganize-docs/mark.html should redirect to en/6.2.x/mark.html - since that page exists, the page redirect shouldn't take place.
Actual Result
en/reorganize-docs/mark.html redirects to en/6.2.x/how-to/mark.html, which is a 404.
The text was updated successfully, but these errors were encountered: