I am using apache RewriteMap with a text file to map some old urls to new urls, in my file (red.map) I have
/old-awful-url.html /new-lovely-shiny-url.html
Then in my apache config I have:-
RewriteEngine On
RewriteMap migration txt:/home/red.map
RewriteCond ${migration:$1} /.+
RewriteRule ^(/.*) ${migration:$1} [L,R=301]
This works fine but now I would like to add a wildcard to the condition to match also some older urls that have the same end but have /cgi-bin/scriptname
in front, eg I also want to match /cgi-bin/scriptname/old-awful-url.html
I tried changing to the RewriteCond to:-
RewriteCond ^.*${migration:$1} /.+
Thinking this would match anything in front of the url in the file, with and without the cgi part, I've tried a few combinations with no success, is this possible?