Help with Helicon Ape RewriteRule

439 Views Asked by At

I have a URL like this:

acme.com/jdoe?CID=dmSSID:561342

and I need to process "jdoe" and the "CID" query strings separately. I can parse "jdoe" with this:

RewriteCond %{HTTP_HOST} ^acme.com$ [NC]  
RewriteRule ^(.+)$ http://www.acme2.com/?x1=$1&CID=$2

but I'm not sure how to include the "CID" URL token to my rule. Any thoughts?

I tried this, but it doesn't work:

RewriteCond %{HTTP_HOST} ^acme.com$ [NC]  
RewriteCond %{QUERY_STRING} ^CID=(.*)$  
RewriteRule ^(.+)$ http://www.acme2.com/?x1=$1&CID=$2

The final URL should look like this:

www.acme2.com/?x1=jdoe&CID=dmSSID:561342
1

There are 1 best solutions below

0
On

For the RewriteCond backreferences, use '%' instead of '$':

RewriteCond %{HTTP_HOST} ^acme.com$ [NC]
RewriteCond %{QUERY_STRING} CID=(.*)
RewriteRule ^(.+)$ http://www.acme2.com/?x1=$1&CID=%1