| # Boilerplate | |
| Options +Indexes | |
| RewriteEngine on | |
| ## Sample redirect rules for every section. | |
| # | |
| # This file assumes that the changelogs are exposed at /changelogs/pool/COMPONENT/..., like | |
| # on the Debian and Ubuntu servers, and that changelogs is a subdirectory of the document root. | |
| # | |
| # The first condition prevents infinite redirects (alternative: RewriteCond $1 !^main$) | |
| # The second condition checks if the requested document exists in another component | |
| # The redirect rule finally performs the redirect to the other commponent | |
| RewriteCond "%{REQUEST_FILENAME}" !-f | |
| RewriteCond "%{DOCUMENT_ROOT}/changelogs/pool/main/$2" -f | |
| RewriteRule "pool/(.*?)/(.*)" "/changelogs/pool/main/$2" [R=301,L] | |
| RewriteCond "%{REQUEST_FILENAME}" !-f | |
| RewriteCond "%{DOCUMENT_ROOT}/changelogs/pool/restricted/$2" -f | |
| RewriteRule "pool/(.*?)/(.*)" "/changelogs/pool/restricted/$2" [R=301,L] | |
| RewriteCond "%{REQUEST_FILENAME}" !-f | |
| RewriteCond "%{DOCUMENT_ROOT}/changelogs/pool/universe/$2" -f | |
| RewriteRule "pool/(.*?)/(.*)" "/changelogs/pool/universe/$2" [R=301,L] | |
| RewriteCond "%{REQUEST_FILENAME}" !-f | |
| RewriteCond "%{DOCUMENT_ROOT}/changelogs/pool/multiverse/$2" -f | |
| RewriteRule "pool/(.*?)/(.*)" "/changelogs/pool/multiverse/$2" [R=301,L] |
nacc
commented
Mar 22, 2017
|
Thanks Julian. This was deployed today on changelogs.ubuntu.com! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
julian-klode commentedMar 15, 2017
•
Edited 1 time
-
julian-klode
Mar 15, 2017
You might want to handle
?parameters in theRewriteRuleby adding(\?.*)?to the source and$3to the target, so these are preserved.Oh, it actually seems to just work, even without special handling :)