...
Then we use this variable with:
%{ENV:default_version}
Current Implementation
The first entity is the pattern to match, the second is the destination, and the third is a test URL. Prod for now doesn't use the default version and just redirects to the root.
Our current default version is master. Either way the default version should be recent information. Queries to old pages are redirected.
Legacy URLs | New URL (desired redirect) | Prod Test URL | Staging Test URL |
---|---|---|---|
^get_started/why_mxnet.html$ | %{ENV:default_version}/faq/why_mxnet.html /versions/master/faq/why_mxnet.html | https://mxnet.incubator.apache.org/get_started/why_mxnet.html | http://34.201.8.176/get_started/why_mxnet.html |
^get_started.*$ | %{ENV:default_version}/install/ /versions/master/install/ | https://mxnet.incubator.apache.org/get_started | http://34.201.8.176/get_started |
^how_to.*$ | %{ENV:default_version}/faq/ /versions/master/faq/ | https://mxnet.incubator.apache.org/how_to/ | http://34.201.8.176/how_to |
^api/python/symbol.html$ | %{ENV:default_version}/api/python/symbol/symbol.html /versions/master/api/python/symbol/symbol.html | https://mxnet.incubator.apache.org/api/python/symbol.html | http://34.201.8.176/api/python/symbol.html |
^community/index.html$ | %{ENV:default_version}/community/contribute.html /versions/master/community/contribute.html | https://mxnet.incubator.apache.org/community/index.html | http://34.201.8.176/community/index.html |
The goal for the following section is that any request to a resource of an old version is redirected to the default version.
http://34.201.8.176/architecture should go to http://34.201.8.176/versions/master/architecture
Note that tutorials will carry the request for the particular tutorial over to the default version. Also, since some of the install links can carry a specific install type it might be good to add $1 to that one.
...
^.*(versions\/[^\/]+)?(?<!master)\/(faq|community|install|gluon|tutorials|architecture)\/(.*)$
Redirect APIs that did not exist
Finally, we have several pages for API that don't exist and it is possible for the user to navigate to them. Instead of a broken page we give them a nice 404 or error message.
...
Test URL: http://34.201.8.176/versions/0.11.0/api/clojure/
Error Pages
ErrorDocument 404 https://mxnet.incubator.apache.org/error/404.html
...
For all other APIs it should allow the queries to go through.
Error Redirect Issues
The error redirect uses a full URL instead of a local one because otherwise the error page doesn't render properly.
...
One approach could be to fix the theme issue as mentioned above or somehow exempt the error page from regular Sphinx theming. Then the local URL could be used.
Testing Redirects
Use the following curl example from command line to see the redirect's output without having to use the browser!
...