Add redirect for more old query string URLs
authorMichael Stapelberg <stapelberg@debian.org>
Tue, 2 May 2017 20:28:37 +0000 (22:28 +0200)
committerMichael Stapelberg <stapelberg@debian.org>
Tue, 2 May 2017 20:29:43 +0000 (22:29 +0200)
fixes https://github.com/Debian/debiman/issues/78

modules/roles/templates/static-mirroring/vhost/manpages.debian.org.erb

index 103b8f1..8305ca6 100644 (file)
        RewriteMap manpagesall dbm:/srv/static.debian.org/mirrors/manpages.debian.org/cur/rwmap.dbm
        RewriteMap lc int:tolower
 
+       # Redirect old CGI paths (without CGI file name), keeping at least the
+       # manpage (the other parameters are left out for simplicity).
+       RewriteCond %{QUERY_STRING} (?:.*(?:^|&))query=([^&]+)
+       RewriteRule ^/?$ /%1 [redirect=307,qsdiscard,last]
+
        # URLs which end in a slash do not need to be rewritten
        RewriteRule /$ - [last]