Forum Moderators: phranque

Message Too Old, No Replies

mod_rewrite - bizzare problems.

IBM http rewrite issue

         

WhiteWorld

4:07 pm on Nov 23, 2004 (gmt 0)

10+ Year Member



Hi, I've not seen this activity in a rewrite before and I'm almost totally stumped so I hope you all can help.

Firstly I've had these working on a Apache server, but when issued to another test server running IBM's HTTP server, okay Apache it fails as soon as regular expressions are used.

The rules in .htaccess, some are hard set for testing on the second server.

RewriteEngine on
Options +FollowSymlinks
RewriteRule ^test$ /app/commerce/command/display?g=1234&p=1234 [NC,L]
RewriteRule ^g([0-9]+)p([0-9]+)$ /app/commerce/command/display?g=1234&p=1234 [NC,L]

Okay [testserver...] works.
But [testserver...] does not, this is in fact what occurs, the url rewrite into the log is showing as /app/commerce/command/display?g=1234g1p1p=1234

So somehow it's working in that it matches the pattern to the uri entered. But then it's adding the pattern into the url on the end of the first parameter. The bizzare thing is the rule is hard coded so how is it doing it and perhaps more crucially any ideas on how to fix this? It only does this IF you add regular expressions into the rule, which is why the test pattern works.

I have mod_rewrite working in many ways but for this simplistic test/requirement which is straight forward it's thrown one heck of a spanner into my day.

Thanks for reading, if you need anything else or can give me a pointer please do post.

Regards,
Colin.

Only now after typing it out have I noticed the & in the URI is missing...how bleary my eyes are. So somthing is replacing the & with the original uri string. Syntax of config?

jdMorgan

10:14 pm on Nov 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Colin,

Welcome to WebmasterWorld!

Yes, it really looks like the "&" is taken as a back-reference to the parenthesized subpattern. You might want to investigate how HP handles back-references, and whether you can "escape" the ampersand or maybe Unicode it.

That is, try things like \& or %46 with [NC,NE,L]

Jim

WhiteWorld

10:09 am on Nov 24, 2004 (gmt 0)

10+ Year Member



Jim,

Thanks for that, I'll send it over to them and see what we can figure out.

Thanks for the welcome; I stumbled upon the site and I cannot belive how many usefull answers I have found out already.

Thanks.