views:

18

answers:

1

Hello all!

I need to create an alias for one exact page which unfortunately special characters in it. I do have an environment set up so other redirects work fine, but not this one:

RewriteRule ^/ow/email.htm?who=Kate%20Jones&direct=True&[email protected]$    http://www.google.com/ow/lalala.htm

How should I rewrite this statement so that it works?

PS. This is my first time here so do let me know if I'm not following stackoverflow policy correctly or smth ;) Thank you so much!

A: 

You need to use the RewriteCond directive for the URI query, either to examine QUERY_STRING:

RewriteCond %{QUERY_STRING} =who=Kate%20Jones&direct=True&[email protected]
RewriteRule ^/ow/email\.htm$ http://www.google.com/ow/lalala.htm

Or the request line in THE_REQUEST:

RewriteCond %{THE_REQUEST} ^GET\ /ow/email\.htm\?who=Kate%20Jones&direct=True&directemail=kate\[email protected]\s
RewriteRule ^/ow/email\.htm$ http://www.google.com/ow/lalala.htm
Gumbo
Works like charm! Thank you so much for explaining how powerful mod_rewrite works!
Kate
@Kate: You’re welcome. Then please accept my answer.
Gumbo