views:

158

answers:

2

Hi

I'm having trouble with my rewritemap not matching things:

RewriteMap map txt:rewritemaps\map.txt  [NC]
RewriteCond ${map:$1|NOT_FOUND} !NOT_FOUND [NC]
RewriteRule ^(.+)$  ${map:$1} [NC, R=301]

The map has about 4,500 entries, including:

arctic  /Destinations/Polar-Regions/The-Arctic.aspx

My RewriteLog, set to level 9, logs:

init rewrite engine with requested uri /arctic
Htaccess process request C:\Program Files\ISAPI Rewrite\httpd.conf
Htaccess process request C:\Websites\Path\WebSite\.htaccess
[..]
applying pattern '^(.+)$' to uri 'arctic'
map lookup FAILED: map=map[txt] key=arctic
RewriteCond: input='NOT_FOUND' pattern='NOT_FOUND' =>

It works with pages not in the map - eg /Contact-Us.aspx, but not with stuff which should match (such as arctic). I've tried changing location of the [NC] flag, removing the RewriteCond and renaming the map file (just in case 'map' was a reserved keyword). No joy. It also doesn't seem to be a permissions problem.

FYI, I'm using ISAPIRewrite by Helicontech as I'm on IIS6.

Any help much appreciated!

Thanks, Adam

A: 

Three suggestions:

  1. Try using a forward slash (/) as the directory separator.
  2. If that doesn't work, try a fully-qualified path.
  3. Try it without the RewriteCond.
Jeremy Stein
A: 

If map.txt is in the same folder with .htaccess, please try the following definition:

RewriteMap map txt:map.txt  [NC]

If it's in another location, please try to use fully-qualified path.

Also please consider updating to the latest build of ISAPI_Rewrite if you are not on it yet.

TonyCool