Sumit Kumar Agarwal
Sumit Kumar Agarwal

Reputation: 59

Redirection of a url using parameter

I am trying to one URL with parameter to another url which doesn't have parameter. I have written below things in apache conf file:

RewriteEngine On

RewriteCond %{REQUEST_URI}  ^/abc/others_jp$

RewriteCond %{QUERY_STRING} ^utm_source=facebook_jp&utm_medium=social&utm_campaign=2014_Facebook_contents&utm_term=other_facebook&utm_content=bridal$

RewriteRule ^(.*)$ http://www.others.com/campaign/link-to-love-2015 [R=302,L]

When i tried, it shows like

http://www.others.com/campaign/link-to-love-2015?utm_source=facebook_jp&utm_medium=social&utm_campaign=2014_Facebook_contents&utm_term=other_facebook&utm_content=bridal

Here I don't want to include the query string in redirected URL.

Upvotes: 0

Views: 26

Answers (1)

arco444
arco444

Reputation: 22841

Just add a ? to the rewrite, that will truncate the query string:

RewriteRule ^(.*)$ http://www.others.com/campaign/link-to-love-2015? [R=302,L]

Upvotes: 0

Related Questions