Skip to content

Commit 517c4e3

Browse files
authored
Split d.p.o redirects to a new config file (#504)
* Split d.p.o redirects to a new config file * Add header note
1 parent 375e1e9 commit 517c4e3

File tree

3 files changed

+231
-215
lines changed

3 files changed

+231
-215
lines changed

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

Lines changed: 3 additions & 215 deletions
Original file line numberDiff line numberDiff line change
@@ -16,221 +16,9 @@ server {
1616

1717
autoindex on;
1818

19-
# Python 3 docs are the default at the root.
20-
location = / {
21-
return 302 $scheme://$host/3/;
22-
}
23-
24-
# Python 3 docs are the default at the root of each translations.
25-
location ~ ^/(es|fr|id|it|ja|ko|pl|pt-br|tr|uk|zh-cn|zh-tw)/$ {
26-
return 302 $scheme://$host/$1/3/;
27-
}
28-
29-
# Pretty 404 for archives telling to wait for them to be built.
30-
location ~ \.(pdf|zip|epub|bz2)$ {
31-
error_page 404 /404.html;
32-
}
33-
34-
# Some doc download pages link to docs.python.org/ftp instead of www.python.org/ftp.
35-
location ^~ /ftp/ {
36-
return 301 https://www.python.org$request_uri;
37-
}
38-
39-
location ~ /py3k(.*)$ {
40-
return 301 https://$host/3$1;
41-
}
42-
43-
# Smooth the switch between versions by mapping old files to their new location
44-
location ~ ^/([a-z-]*/)?(3|3.6|3.7|3.8)/library/email.util.html$ {
45-
return 301 https://$host/$1$2/library/email.utils.html;
46-
}
47-
location ~ ^/([a-z-]*/)?(3|3.5|3.6|3.7|3.8|3.9|3.10)/c-api/(class|cobject|int|string).html$ {
48-
return 301 https://$host/$1$2/c-api/;
49-
}
50-
location ~ ^/([a-z-]*/)?(3|3.5|3.6|3.7|3.8|3.9|3.10)/howto/(doanddont|webservers).html$ {
51-
return 301 https://$host/$1$2/;
52-
}
53-
location ~ ^/([a-z-]*/)?(3|3.5|3.6|3.7|3.8|3.9|3.10)/library/(aepack|aetools|aetypes|al|autogil|bastion|bsddb|carbon|cd|colorpicker|commands|compiler|dbhash|dircache|dl|dummy_thread|easydialogs|fl|fm|fpectl|fpformat|framework|future_builtins|gensuitemodule|gl|hotshot|htmllib|ic|imageop|imgfile|imputil|jpeg|mac|macos|macosa|macostools|md5|mhlib|mimetools|mimewriter|mimify|miniaeframe|multifile|mutex|new|popen2|posixfile|restricted|rexec|rfc822|sgi|sgmllib|sha|someos|statvfs|sun|sunaudio|user).html$ {
54-
return 301 https://$host/$1$2/;
55-
}
56-
location ~ ^/([a-z-]*/)?(3|3.5|3.6|3.7|3.8|3.9|3.10)/library/strings.html$ {
57-
return 301 https://$host/$1$2/library/text.html;
58-
}
59-
location ~ ^/([a-z-]*/)?(3|3.5|3.6|3.7|3.8|3.9|3.10)/library/stringio.html$ {
60-
return 301 https://$host/$1$2/library/io.html#io.StringIO;
61-
}
62-
location ~ ^/([a-z-]*/)?(3|3.5|3.6|3.7|3.8|3.9|3.10)/library/sets.html$ {
63-
return 301 https://$host/$1$2/library/stdtypes.html#set-types-set-frozenset;
64-
}
65-
location ~ ^/([a-z-]*/)?(3|3.5|3.6|3.7|3.8|3.9|3.10)/library/userdict.html$ {
66-
return 301 https://$host/$1$2/library/collections.html#userdict-objects;
67-
}
68-
location ~ ^/([a-z-]*/)?(3|3.5|3.6|3.7|3.8|3.9|3.10)/library/repr.html$ {
69-
return 301 https://$host/$1$2/library/reprlib.html;
70-
}
71-
location ~ ^/([a-z-]*/)?(3|3.5|3.6|3.7|3.8|3.9|3.10)/library/copy_reg.html$ {
72-
return 301 https://$host/$1$2/library/copyreg.html;
73-
}
74-
location ~ ^/([a-z-]*/)?(3|3.5|3.6|3.7|3.8|3.9|3.10)/library/anydbm.html$ {
75-
return 301 https://$host/$1$2/library/dbm.html;
76-
}
77-
location ~ ^/([a-z-]*/)?(3|3.5|3.6|3.7|3.8|3.9|3.10)/library/whichdb.html$ {
78-
return 301 https://$host/$1$2/library/dbm.html#dbm.whichdb;
79-
}
80-
location ~ ^/([a-z-]*/)?(3|3.5|3.6|3.7|3.8|3.9|3.10)/library/dumbdbm.html$ {
81-
return 301 https://$host/$1$2/library/dbm.html#module-dbm.dumb;
82-
}
83-
location ~ ^/([a-z-]*/)?(3|3.5|3.6|3.7|3.8|3.9|3.10)/library/gdbm.html$ {
84-
return 301 https://$host/$1$2/library/dbm.html#module-dbm.gnu;
85-
}
86-
location ~ ^/([a-z-]*/)?(3|3.5|3.6|3.7|3.8|3.9|3.10)/library/robotparser.html$ {
87-
return 301 https://$host/$1$2/library/urllib.robotparser.html;
88-
}
89-
location ~ ^/([a-z-]*/)?(3|3.5|3.6|3.7|3.8|3.9|3.10)/library/thread.html$ {
90-
return 301 https://$host/$1$2/library/_thread.html;
91-
}
92-
location ~ ^/([a-z-]*/)?(3|3.5|3.6|3.7|3.8|3.9|3.10)/library/email-examples.html$ {
93-
return 301 https://$host/$1$2/library/email.examples.html;
94-
}
95-
location ~ ^/([a-z-]*/)?(3|3.5|3.6|3.7|3.8|3.9|3.10)/library/htmlparser.html$ {
96-
return 301 https://$host/$1$2/library/html.parser.html;
97-
}
98-
location ~ ^/([a-z-]*/)?(3|3.5|3.6|3.7|3.8|3.9|3.10)/library/urllib2.html$ {
99-
return 301 https://$host/$1$2/library/urllib.request.html;
100-
}
101-
location ~ ^/([a-z-]*/)?(3|3.5|3.6|3.7|3.8|3.9|3.10)/library/httplib.html$ {
102-
return 301 https://$host/$1$2/library/http.client.html;
103-
}
104-
location ~ ^/([a-z-]*/)?(3|3.5|3.6|3.7|3.8|3.9|3.10)/library/urlparse.html$ {
105-
return 301 https://$host/$1$2/library/urllib.parse.html;
106-
}
107-
location ~ ^/([a-z-]*/)?(3|3.5|3.6|3.7|3.8|3.9|3.10)/library/basehttpserver.html$ {
108-
return 301 https://$host/$1$2/library/http.server.html;
109-
}
110-
location ~ ^/([a-z-]*/)?(3|3.5|3.6|3.7|3.8|3.9|3.10)/library/simplehttpserver.html$ {
111-
return 301 https://$host/$1$2/library/http.server.html#http.server.SimpleHTTPRequestHandler;
112-
}
113-
location ~ ^/([a-z-]*/)?(3|3.5|3.6|3.7|3.8|3.9|3.10)/library/cgihttpserver.html$ {
114-
return 301 https://$host/$1$2/library/http.server.html#http.server.CGIHTTPRequestHandler;
115-
}
116-
location ~ ^/([a-z-]*/)?(3|3.5|3.6|3.7|3.8|3.9|3.10)/library/cookielib.html$ {
117-
return 301 https://$host/$1$2/library/http.cookiejar.html;
118-
}
119-
location ~ ^/([a-z-]*/)?(3|3.5|3.6|3.7|3.8|3.9|3.10)/library/cookie.html$ {
120-
return 301 https://$host/$1$2/library/http.cookies.html;
121-
}
122-
location ~ ^/([a-z-]*/)?(3|3.5|3.6|3.7|3.8|3.9|3.10)/library/xmlrpclib.html$ {
123-
return 301 https://$host/$1$2/library/xmlrpc.client.html;
124-
}
125-
location ~ ^/([a-z-]*/)?(3|3.5|3.6|3.7|3.8|3.9|3.10)/library/simplexmlrpcserver.html$ {
126-
return 301 https://$host/$1$2/library/xmlrpc.server.html;
127-
}
128-
location ~ ^/([a-z-]*/)?(3|3.5|3.6|3.7|3.8|3.9|3.10)/library/docxmlrpcserver.html$ {
129-
return 301 https://$host/$1$2/library/xmlrpc.server.html#documenting-xmlrpc-server;
130-
}
131-
location ~ ^/([a-z-]*/)?(3|3.5|3.6|3.7|3.8|3.9|3.10)/library/ttk.html$ {
132-
return 301 https://$host/$1$2/library/tkinter.ttk.html;
133-
}
134-
location ~ ^/([a-z-]*/)?(3|3.5|3.6|3.7|3.8|3.9|3.10)/library/tix.html$ {
135-
return 301 https://$host/$1$2/library/tkinter.tix.html;
136-
}
137-
location ~ ^/([a-z-]*/)?(3|3.5|3.6|3.7|3.8|3.9|3.10)/library/scrolledtext.html$ {
138-
return 301 https://$host/$1$2/library/tkinter.scrolledtext.html;
139-
}
140-
location ~ ^/([a-z-]*/)?(3|3.5|3.6|3.7|3.8|3.9|3.10)/library/__builtin__.html$ {
141-
return 301 https://$host/$1$2/library/builtins.html;
142-
}
143-
location ~ ^/([a-z-]*/)?(3|3.5|3.6|3.7|3.8|3.9|3.10)/library/_winreg.html$ {
144-
return 301 https://$host/$1$2/library/winreg.html;
145-
}
146-
location ~ ^/([a-z-]*/)?(3|3.12|3.13|3.14)/library/(asynchat|asyncore|smtpd).html$ {
147-
return 301 https://$host/$1$2/;
148-
}
149-
location ~ ^/([a-z-]*/)?(3.13|3.14)/library/(2to3|aifc|audioop|cgi|cgitb|chunk|crypt|imghdr|mailcap|msilib|nis|nntplib|ossaudiodev|pipes|sndhdr|spwd|sunau|telnetlib|tkinter.tix|uu|xdrlib).html$ {
150-
return 301 https://$host/$1$2/;
151-
}
152-
153-
# Map /documenting to the devguide.
154-
location ~ ^/devguide/(.*)$ {
155-
return 301 https://devguide.python.org/$1;
156-
}
157-
location = /documenting/ {
158-
return 301 https://devguide.python.org/documentation/start-documenting/;
159-
}
160-
location = /documenting/index.html {
161-
return 301 https://devguide.python.org/documentation/start-documenting/;
162-
}
163-
location = /documenting/intro.html {
164-
return 301 https://devguide.python.org/documentation/start-documenting/#introduction;
165-
}
166-
location = /documenting/style.html {
167-
return 301 https://devguide.python.org/documentation/style-guide/;
168-
}
169-
location = /documenting/rest.html {
170-
return 301 https://devguide.python.org/documentation/markup/;
171-
}
172-
location = /documenting/markup.html {
173-
return 301 https://devguide.python.org/documentation/markup/;
174-
}
175-
location = /documenting/fromlatex.html {
176-
return 301 https://devguide.python.org/documentation/markup/;
177-
}
178-
location = /documenting/building.html {
179-
return 301 https://devguide.python.org/documentation/start-documenting/#building-the-documentation;
180-
}
181-
182-
# Map toplevel URIs to Python 3 docs.
183-
location ~ ^/((archives|c-api|distutils|extending|faq|howto|install|library|reference|tutorial|using|whatsnew|_images|_sources|_static)(/.*)?)$ {
184-
return 301 https://$host/3/$1;
185-
}
186-
location ~ ^/(about|bugs|contents|copyright|download|genindex.*|glossary|index|license|py-modindex|search)(.html)?$ {
187-
return 301 https://$host/3/$1.html;
188-
}
189-
location ~ ^/(searchindex.js|objects.inv)$ {
190-
return 301 https://$host/3/$1;
191-
}
192-
193-
# Emulate Apache's content-negotiation. Was a temporary measure,
194-
# but now people are using it like a feature.
195-
# Redirect ``$request_uri`` -> ``$request_uri.html``,
196-
# where the latter is a valid webpage.
197-
location ~ ^/((2|3)(\.[0-9]+)?|dev)/\w+/[\d\w\.]+(?!\.html)$ {
198-
if (-f "${request_filename}.html") {
199-
return 301 https://$host:$request_uri.html;
200-
}
201-
}
202-
203-
# Map old, 2.5-and-earlier directory names to 2.6-and-later names.
204-
location = /lib/ {
205-
return 301 https://$host/library/;
206-
}
207-
location ~ ^/lib/module-([a-zA-Z0-9.]+)\.html$ {
208-
return 301 https://$host/library/$1.html;
209-
}
210-
location = /tut/ {
211-
return 301 https://$host/tutorial/;
212-
}
213-
location = /tut/tut.html {
214-
return 301 https://$host/tutorial/;
215-
}
216-
location = /api/ {
217-
return 301 https://$host/c-api/;
218-
}
219-
location = /ext/ {
220-
return 301 https://$host/extending/;
221-
}
222-
location = /dist/ {
223-
return 301 https://docs.python.org/distutils/;
224-
}
225-
location = /inst/ {
226-
return 301 https://$host/install/;
227-
}
228-
location = /doc/ {
229-
return 301 https://devguide.python.org/documenting.html;
230-
}
231-
location = /ref/ {
232-
return 301 https://$host/reference/;
233-
}
19+
# The redirect config for docs.python.org is in a separate file
20+
# to allow automatic testing via Hurl (https://hurl.dev/)
21+
include docs-redirects.conf;
23422
}
23523

23624
server {

0 commit comments

Comments
 (0)