Help with rewrites based on a map

Topics: Developer Forum
May 28, 2012 at 10:00 PM


I'm hoping somebody might be able to help. I have installed IIRF 2.1 and got it working fine for redirects and rewrites for SEO friendly URLs. Now, I need to try and get it working from a map, as the site I am working with has hundreds of thousands of URL combinations. 

System/OS: 2.0 IIS6 Windows Server 2003 SP2

I have followed the examples and the documentation, but just don't seem to be able to get it to behave as I need.

To test, I am just trying with 1 mapped parameter, but I am assuming multiple mapped parameters can be used as the same time?

Site URL Structure:

Desired URL: if type 12 = hotels and locationID 4477 is leeds

I can do this with no map as follows:

RewriteLog D:\Home\Default\htdocs\_iirflogs\iirf
RewriteLogLevel 1
RewriteEngine ON
StatusInquiry ON
 ReWriteRule ^/hotels/leeds  /search/results.aspx?typeid=12&locationid=4477 [L]

 RedirectRule ^/.*results\.aspx\?typeid=12&locationid=4477$ [R=301]


Next I try with a map as follows (just testing with a single parameter to start)

RewriteLog D:\Home\htdocs\_iirflogs\iirf
RewriteLogLevel 1
RewriteEngine ON
StatusInquiry ON
# load in the location map
RewriteMap  locidmap txt:D:\Home\Default\htdocs\_mapping\locations.txt

# rewrite any requests for location info as appropriate
RewriteRule  ^/(.*)/hotels /search/results.aspx?locationid=${locidmap :$1} [L]


And the map contents is as follows:

# Location map file
# It is stored in D:\Home\Default\htdocs\_mapping\locations.txt

London		1
Manchester	5
Leeds		12


I have tried tweaking the redirect rule in a few ways, but can't get it to work. The result is either 'nothing' i.e. the site behaves as it used to before the IIRF config, or it puts a partial text string of the redirect rule into the locationid.

I am starting to think I must be missing something blindingly obvious, or there is a fundamental problem on the site set up causing this to fail for me. Any help or guidance would be massively appreciated!


Kind Regards