Repository navigation
Redirect full version archive files to {major}.{minor} - #498
Conversation
| # Map archive URLs to {major}.{minor} | ||
| 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)$ { | ||
| return 301 https://$host/$1$2/archives/python-$3-docs$6; | ||
| } |
There was a problem hiding this comment.
This might be clearer?:
cc @JacobCoffee -- I don't know if you have or know of any guidance on best formatting for these redirect rules.
| # Map archive URLs to {major}.{minor} | |
| 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)$ { | |
| return 301 https://$host/$1$2/archives/python-$3-docs$6; | |
| } | |
| # Map archive URLs to {major}.{minor} | |
| 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)$ { | |
| return 301 https://$host/$1$2/archives/python-$3-docs-$6.$7; | |
| } | |
| location ~ ^/([a-z-]*/)?(3|3.12|3.13|3.14)/archives/python-(3.12|3.13|3.14)\.\d+((a|b|rc)\d)?-docs\.epub$ { | |
| return 301 https://$host/$1$2/archives/python-$3-docs.epub; | |
| } |
There was a problem hiding this comment.
given the nature of the capture groups i think there isnt much formatting that could save us! it looks pretty good to me, imo
I do think the separation for epub just adds a whole bunch of duplication and could still sit on the original single location block with the rest... but maybe @ewdurbin has more insight
|
For the sake of understanding... Can you give a few explicit examples of what the redirects desired are? I'm having a hard time working backward from the regex |
The full list of expected filenames is in the opening post, redirecting a A |
|
Are these redirects effective if the original URL is not found as a file? |
|
The redirects are always active regardless of the filesystem -- the issue is that an archive called "3.X.Y" is not the same as the documentation at time of Python 3.X.Y's release. It is simpler to explain when we just present the archives for Python 3.X, and state that they're the current state of the branch -- to get versioned archives, use https://docs.python.org/release/. A |
1677ed4 to
2479524
Compare
)" This reverts commit 355ffe5.
This aims to redirect archive URLs with full release versions to
{major}.{minor}:python-{release}-docs-html.tar.bz2python-{release}-docs-html.zippython-{release}-docs-pdf-a4.tar.bz2python-{release}-docs-pdf-a4.zippython-{release}-docs-pdf-letter.tar.bz2python-{release}-docs-pdf-letter.zippython-{release}-docs-texinfo.tar.bz2python-{release}-docs-texinfo.zippython-{release}-docs-text.tar.bz2python-{release}-docs-text.zippython-{release}-docs.epub[Edit 26/Sep 18:00 BST -- the new format files are now built on 3.12 and 3.14 for all languages, and 3.13 for English with translations in progress currently (should take ~9 hours), so this can be merged tomorrow at the earliest]
A