Debian / debiman

debiman generates a static manpage HTML repository out of a Debian archive
Apache License 2.0
188 stars 46 forks source link

old ?query= parameter ignored/failing #78

Closed anarcat closed 7 years ago

anarcat commented 7 years ago

I have found links in the wild (in my own blog, namely) that point to ?query=man-style URLs. An example I had was:

https://manpages.debian.org/?query=dh-make

Those do not work anymore: they just show the homepage.

Now, maybe that never worked, but I'm pretty confident it did. Do we want to support old URLs like this?

stapelberg commented 7 years ago

In general, yes, old URLs should be supported if that’s easy. The redirects are configured at https://anonscm.debian.org/git/mirror/dsa-puppet.git/tree/modules/roles/templates/static-mirroring/vhost/manpages.debian.org.erb#n26

anarcat commented 7 years ago

Looks like this could be expanded by removing the condition?

    # Redirect old CGI paths, keeping at least the manpage (the other
    # parameters are left out for simplicity).
    RewriteCond %{QUERY_STRING} ^$
    RewriteRule ^/cgi-bin/man.cgi$ / [redirect=301,last]
    RewriteCond %{QUERY_STRING} (?:.*(?:^|&))query=([^&]+)
    RewriteRule ^/cgi-bin/man.cgi /%1 [redirect=307,qsdiscard,last]

... not sure.

stapelberg commented 7 years ago

Inserting the following lines above line 16 works in my local tests:

    RewriteCond %{QUERY_STRING} (?:.*(?:^|&))query=([^&]+)
    RewriteRule ^/?$ /%1 [redirect=307,qsdiscard,last]

I’ll ask DSA to pull my config change.

stapelberg commented 7 years ago

Forgot to follow up on this issue, but the changes were merged two weeks ago and the syntax actually works.