Sign up ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I am very new to mod rewrite. I need to redirect any user with "citzenhawk" parameter in their url to my url

for example

should result into

Here are my rewrite conditions:

RewriteCond %{QUERY_STRING} (&|^)cm_mmc=(.)citizenhawk(.)(&|$)$ 
RewriteRule ^/rrs/ [NC,R=302,L]

Where am I going wrong? Is my RewriteCond wrong?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Try this:

RewriteCond %{QUERY_STRING} cm_mmc=(.*)citizenhawk
RewriteRule ^.* /rrs? [R=permanent]
share|improve this answer
Thanks j0k for your response. I do not have any testing environment and do not wish to put this in production without testing. Is there any online tool available so i can test this condition? Thanks again for your help. – modrewriteNewbie Aug 29 '12 at 18:39
If you a local computer with a running apache you can test it easily by create an index.php, a .htaccess (with the rules inside) and access index.php?sc=CX12N003&cm_mmc=affiliate--citizenhawk--nooffer-_-na&prfc=5&clicki‌​d=0004c845fa9a87050a4277221a003262 – j0k Aug 29 '12 at 18:48
I just tried on Windows7 Apache2.2.22 and it works if second line is RewriteRule ^.* /$1? [R=permanent]. – galeksic Aug 29 '12 at 19:09
Thanks a ton for your prompt answer. It works great :) except for one issue...i forgot to mention that when i get redirected to my website i would like to append url with rrs. For example if you type‌​na&prfc=5&clickid=0004c845fa9a87050a4277221a003262, it should be redirected to . sorry i forgot to mention this before. – modrewriteNewbie Aug 29 '12 at 19:16
Great! If my suggestion works, then try RewriteRule ^.* /rrs/$1? [R=permanent]. – galeksic Aug 29 '12 at 19:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.