Forum Moderators: phranque

Message Too Old, No Replies

Query string problem I haven't found on message board

Query string problem

         

cctrickey

4:29 am on Jun 29, 2007 (gmt 0)

10+ Year Member



I have recently found out about the mod_rewrite module but can't figure out how to make it work in my situation. I am currently moving from IIS/Servlet exec to Apache/Tomcat and have an issue with a redirect that I am trying to use. Right now with IIS I am using the following:

[servername.com...] redirected to [anotherserver.com...]

$P is the IIS variable that I am using to pass the query string, which strips off the? mark which is what I need. I have tried doing a straight 301 redirect permanent with Apache but it passes the? mark along with the query string which doesn't let me set the eid field. One thing I might add is that ACM12345678 is dynamic and the numbers will always change. I tried using the following but it doesn't work. I know that I am messing the syntax up so be gentle with your comments please.

RewriteCondition ^ACM[0-9]*
RewriteRule ^/ACM/?$ [servername.com...]

I am doing this in the httpd.conf file and this is running on a Windows server if that is any help.

Any help would be greatly appreciated.

jdMorgan

7:12 pm on Jun 29, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Changes in bold:

RewriteCond [b]%{QUERY_STRING}[/b] ^ACM([0-9]+)
RewriteRule ^/ACM/?$ http://www.example.com/arsys/forms/appserver/ACM:ChangeManagement/Defau[b]lt?eid=%1[/b] [R=301,L]

A possible problem is that the "&" should be dropped from the end of "Default" in the new URL-path -- Ampersands are not valid preceding "?" in a well-formed URI [faqs.org], and this character will have to be be hex-encoded for transmission. Get rid of it if possible.

Jim