-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
No wildcard redirects possible? #3465
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
Comments
The 'Enhancement' tag added by @RichardLitt suggests that it's b) indeed...what a relief 😜 |
Best guess on my part. Let's see what the others have to say. :) |
I need to do something similar, so I looked at code here: https://github.com/rtfd/readthedocs.org/blob/96f6da57d89a37bdfa6b99de93e8ae6d09e2a586/readthedocs/redirects/models.py There does not seem to be any wildcards, but I see that exact redirects have a '$rest' parameter. I think this will allow you to do what you want, by the following pattern:
Note: The |
You mean https://github.com/rtfd/readthedocs.org/blob/96f6da57d89a37bdfa6b99de93e8ae6d09e2a586/readthedocs/redirects/models.py#L134 right? I don't see support for either I was recently testing redirects w/ modifying my file structure first (i.e. I didn't have any invalid links) and was then wondering why my redirect rules weren't applied at all. Turns out they're only active after HTTP 404 was detected:
|
Yes, looking closer on this I see that. Are you sure your case can't be covered by the prefix redirect? |
I have a case needing wildcard redirects that one language of translation is completely hosted somewhere else, so I'd like to redirect |
The rest keyword is now documented https://docs.readthedocs.io/en/latest/user-defined-redirects.html#exact-redirects Looks like it solves all the problems here, not sure if a wildcard is still needed after that. |
Thanks for that extra documentation. So, are you convinced that I could solve the original requirement (as per my description) with an exact redirect? I'm not convinced yet. What would you say is the rule I'd have to configure? |
I believe |
@marcelstoer could you please test the solution that @stsewd provided? I think that should achieve your goal. I want to have something actionable on this issue or close it. |
This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further. Thanks! |
@humitos it's great that you documented this behavior back in August in f434859. What I didn't get initially is that |
When we started with RTD & MkDocs two years ago we tried to work around some l10n shortcomings ourselves. Turns out we don't need that all; all files can be moved up one level in the directory tree. To avoid dead links we'd like to configure wild card redirects to omit that extra folder in the URL.
Examples:
In short, in mod_rewrite terms this would be
/$lang/$version/en/(.*) -> /$lang/$version/$1
.I studied the three redirect options in the documentation and ran a few tests but a) I'm either too stupid to get it or b) then such wild card redirects really aren't supported. If b) then https://github.com/honzajavorek/rtd-redirects might come in handy for us.
The text was updated successfully, but these errors were encountered: