Mod_rewrite problem in Apache

My companies website CSA Travel Protection has been using IIS to talk with Tomcat to host our jsp’s. We bought Helicon’s ISAPI Rewrite software to perform rewrites of our url. As of late we are looking to get IIS out of the picture and switch to Apache instead. In a test environment, I was having problems getting the Mod_rewrite to work properly. The way Helicon and Mod_Rewrite interpret the formatting is slightly different from each other. I was simply trying to do a simple rewrite like this:

# Employment
RewriteRule ^/partner$ /partner.do

This was causing the message in the rewrite log file to be:

[rid#7d3160/initial] (2) rewrite /partner -> /welcome.do?pmode=partner
10.10.1.207 – – [11/May/2006:14:36:08 –0700] [my.computer.name/sid#61f2e8][rid#7d3160/initial] (3) split uri=/welcome.do?pmode=partner -> uri=/welcome.do, args=pmode=partner
10.10.1.207 – – [11/May/2006:14:36:08 –0700] [my.computer.name/sid#61f2e8][rid#7d3160/initial] (2) local path result: /welcome.do
10.10.1.207 – – [11/May/2006:14:36:08 –0700] [my.computer.name/sid#61f2e8][rid#7d3160/initial] (2) prefixed with document_root to C:/jakarta-tomcat-5.5.12/webapps/csa/welcome.do
10.10.1.207 – – [11/May/2006:14:36:08 –0700] [my.computer.name/sid#61f2e8][rid#7d3160/initial] (1) go-ahead with C:/jakarta-tomcat-5.5.12/webapps/csa/welcome.do [OK]

It seems as if I have to pass through the rewritten URL to Tomcat and need to use the PT Passthrough flag.
# Employment
RewriteRule ^/employment$ /employment.do [NC,PT]

This has allowed me to migrate from Helicon’s ISAPI Rewrite to Apache’s Mod_Rewrite.

1 Comment on “Mod_rewrite problem in Apache

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.