RewriteRule to disregard a url variable

Posted by tridat on Stack Overflow See other posts from Stack Overflow or by tridat
Published on 2009-12-15T06:59:21Z Indexed on 2010/04/14 22:03 UTC
Read the original article Hit count: 233

Filed under:
|
|

I have some pages indexed by Google, for example:

/product.html?affiliateid=142

I want a rewrite rule to 301 redirect to the same page if there's an affiliateid=xxx

So far I have this:

RewriteCond %{QUERY_STRING}  ^affiliateid=[0-9]+$
RewriteRule ^$ /test.html$ [L,R=301]

But its not working, I need to get rid of the variable and get the page name somehow.

© Stack Overflow or respective owner

Related posts about apache

Related posts about rewriterule