Hi,
I have an htaccess file which begins with the regular stuff:
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
then has a few rewrites eg:
RewriteRule ^protect/?$ /Legal/Your-Financial-Protection.aspx [NC, L, R=301]
then ends with a rewritemap:
RewriteMap map txt:rewritemaps/map.txt [NC]
RewriteRule ^(.+)$ ${map:$1} [R=301]
The rewritemap contains all of our legacy urls - pages on our current site and short urls that will be redirected to equivalent pages on the new site (there are about 4k, so I need to use a map really):
Inspiration.aspx /Inspiration.aspx
Destinations/Africa/Countries/Gabon.aspx /Destinations/Africa/Gabon.aspx
indonesia /Destinations/Southeast-Asia/Indonesia.aspx
The problem is, with the rewritemap enabled (ie not commented out), all my urls (even those not matched) redirect to / - including stylesheets, js, images etc.
What I'm after is uris that match the pattern in the map to redirect to the replacement and everything else to pass through (ie stay the same).
I've tried setting a default of $1 on the map:
RewriteRule ^(.+)$ ${map:$1|$1} [R=301]
but this just causes a redirect loop. I think I could also skip rewriting for all .css, .js, .jpg etc but would rather not have to maintain a list of used file extensions.
FYI, I'm using ISAPIRewrite from HeliconTech (as I'm on IIS 6) although it claims to handle rewritemaps as per apache and we've never had problems in the past.
Any help would be hugely appreciated!
Thanks, Adam