Link to home
Start Free TrialLog in
Avatar of avir
avir

asked on

isapi rewrite and map file not working

I don't seem to be able to get this question answered, but I'll try again.
I am playing around with isapi rewrite lite with only limited success. I'm trying to substitute the url querystring parameter with it's value. I have gotten it work, but I can't seem to be able to implement a parameter substitution using a map file. I'm working in classic ASP on Windows 2003 with isapi version 3.

In my httpd.conf file this works:

RewriteCond %{QUERY_STRING} ^cy=(\d+)$ [NC]
RewriteRule ^imagine/ketubot/$ imagine/ketubot/%1? [NC,R=301,L]
RewriteRule ^imagine/ketubot/(\d+)$ imagine/ketubot/?cy=$1 [NC,L]

and I get a url like /imagine/ketubot/5 in place of /imagine/ketubot/?cy=5

This doesn't work:

RewriteMap mapfile txt:mapcountries.txt [NC]
RewriteRule ^imagine/ketubot/(\d+)$ imagine/ketubot/?cy=${mapfile:$1}

and it remains with /imagine/ketubot/?cy=5
instead of what I hoped to get: /imagine/ketubot/Algeria

I would appreciate any help with this. Thanks
SOLUTION
Avatar of Gregg
Gregg
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I had one more thought. If you have your RewriteRules in the Apache Configuration file, dont you need a leading slash in both pattern and target?

RewriteRule ^/imagine/ketubot/(\d+)$ /imagine/ketubot/?cy=${mapfile:$1}

-- I just cant remember.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
good to see you have a solution. best of luck!
avir, for fun, experiment with the [NC] on the mapfile values. See if nocase does not matter.
Avatar of avir
avir

ASKER

Doesn't seem to make a difference one way or another. I removed the [NC] and changed the values to with and without uppercase and it doesn't seem to matter. It still works. Unless I'm not understanding what [NC] means.
Thanks, i was interested in the results. :)
Avatar of avir

ASKER

I searched and found a comprehensive solution to my problem on the Helicon forum.