File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,15 @@ Page not found
2424 </p >
2525
2626 <script >
27+ // If we were redirected to `/en/4.x/` as a result of the RTD language selector,
28+ // redirect to `/en/stable/` instead, as English does not have a `4.x` branch.
29+ // (For maintenance reasons, non-English languages have a single `4.x` branch
30+ // that is the counterpart of `4.3`, `4.4`, `4.5`, and so on.)
31+ if (window .location .pathname .includes (' /en/4.x/' )) {
32+ const newUrl = window .location .pathname .replace (' /en/4.x/' , ' /en/stable/' );
33+ window .location .replace (newUrl);
34+ }
35+
2736 // Check for redirects if on a currently invalid page.
2837 // This is done in JavaScript, as we exceed Read the Docs' limit for the amount of redirects configurable.
2938 // When testing this feature on a local web server, replace the URL below with just `/_static/redirects.csv`.
You can’t perform that action at this time.
0 commit comments