This is useful if you switch to hosting your own documentation, for example using Sphinx Multiversion on Github pages, tutorial coming soon.
We want to be able to redirect from
readthedocs keeping the relative url.
First we can setup user-defined redirects from the admin page on
see the full documentation,
you can choose “Exact redirect”, I only care about redirecting the
latest version, so:
/en/latest/$rest -> https://myorganization.github.io/myrepo/master/
$rest is a special variable which redirects also all the other pages correctly.
The only issue now is that this redirect only works when the documentation is not found,
therefore I made a temporary commit to
master which deletes all of the Sphinx pages
of the documentation and replaces
readthedocs builds this version, go to https://github.com/myorganization/myrepo/settings/hooks and disable
readthedocs web hook.
Finally restore the documentation on your master branch and push.