Skip to content

Commit 355ffe5

Browse files
authored
Redirect full version archive files to {major}.{minor} (#498)
* Redirect full version archive files to ``{major}.{minor}`` * Add tests
1 parent 7416f18 commit 355ffe5

File tree

2 files changed

+6095
-5
lines changed

2 files changed

+6095
-5
lines changed

salt/docs/config/nginx.docs-redirects.conf

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@ location ~ ^/(es|fr|id|it|ja|ko|pl|pt-br|tr|uk|zh-cn|zh-tw)/$ {
1212
return 302 $scheme://$host/$1/3/;
1313
}
1414

15-
# Pretty 404 for archives telling to wait for them to be built.
16-
location ~ \.(pdf|zip|epub|bz2)$ {
17-
error_page 404 /404.html;
18-
}
19-
2015
# Some doc download pages link to docs.python.org/ftp instead of www.python.org/ftp.
2116
location ^~ /ftp/python/doc {
2217
return 301 https://www.python.org$request_uri;
@@ -197,6 +192,11 @@ location ~ ^/(es|fr|id|it|ja|ko|pl|pt-br|tr|uk|zh-cn|zh-tw)/((2|3)(\.[0-9]+)?|de
197192
add_header Surrogate-Key $1/$2 always;
198193
}
199194

195+
# Map archive URLs to {major}.{minor}
196+
location ~ ^/([a-z-]*/)?(3|3.12|3.13|3.14)/archives/python-(3.12|3.13|3.14)\.\d+((a|b|rc)\d)?-docs(-(html|pdf-a4|pdf-letter|texinfo|text)\.(zip|tar\.bz2)|\.epub)$ {
197+
return 301 https://$host/$1$2/archives/python-$3-docs$6;
198+
}
199+
200200
# Map old, 2.5-and-earlier directory names to 2.6-and-later names.
201201
location = /lib/ {
202202
return 301 https://$host/3/library/;
@@ -228,3 +228,8 @@ location = /doc/ {
228228
location = /ref/ {
229229
return 301 https://$host/3/reference/;
230230
}
231+
232+
# Pretty 404 for archives telling to wait for them to be built.
233+
location ~ \.(pdf|zip|epub|bz2)$ {
234+
error_page 404 /404.html;
235+
}

0 commit comments

Comments
 (0)