fix tor browser legacy wiki redirection
in #40233 (closed), @sysrqb wrote:
I wonder if we can use a rewritemap and rewriterule for dynamically redirecting (almost all?) pages. As an example, if we look at two Tor Browser wiki pages:
(Using the archived version for reference: https://web.archive.org/web/20200617155921/https://trac.torproject.org/projects/tor/wiki/doc/TorBrowser)
https://trac.torproject.org/projects/tor/wiki/doc/TorBrowser -> https://gitlab.torproject.org/tpo/applications/tor-browser/-/wikis/ https://trac.torproject.org/projects/tor/wiki/doc/TorBrowser/Release_Schedule -> https://gitlab.torproject.org/tpo/applications/tor-browser/-/wikis/Release-Schedule
I think we can use a prg rewritemap, and following that example:
+ RewriteMap u2d "prg:/path/to/trac_under2gl_dash.pl" + RewriteRule ^/projects/tor/wiki/doc/TorBrowser/(.*) "https://gitlab.torproject.org/tpo/applications/tor-browser/-/wikis/${u2d:$1}" [R]
Where
trac_under2gl_dash.pl
is something like:#!/usr/bin/perl $| = 1; # Turn off I/O buffering while (<STDIN>) { s/_/-/g; # Replace underscores with dashes print $_; }
Would something like this be an unacceptable solution?
I responded there, but I figured I would open an issue specifically for this group of pages, to make sure I don't forget about this useful information which is basically:
"Please redirect /projects/tor/wiki/doc/TorBrowser/
to https://gitlab.torproject.org/tpo/applications/tor-browser/-/wikis/
. Be careful because underscores are replaced with dashes."