1

I would remove color_new=any-value-could-be-here anywhere in URL via .htaccess So how to do it?

Kevin Smith
  • 111
  • 7

1 Answers1

1

You can use this rule to remove a query parameter from any where in query string:

RewriteEngine On

RewriteCond %{QUERY_STRING} ^(.+?&)?color_new=[^&]*(?:&(.*))?$
RewriteRule ^ %{REQUEST_URI}?%1%2 [R=302,L]

Keep this rule above other rules.

anubhava
  • 761,203
  • 64
  • 569
  • 643
  • I use 302 for testing phase to avoid bad cache in browsers. Once you verify rule is working fine for you then you can change 302 to 301. – anubhava Dec 30 '15 at 14:33
  • It works man! I really need your help on my last question, can you work on it as it's more complicated. thanks – Kevin Smith Dec 30 '15 at 14:37
  • http://stackoverflow.com/questions/34527744/how-to-remove-empty-parameter-or-parameters-anywhere-in-url-by-htaccess – Kevin Smith Dec 30 '15 at 14:40