2016-09-06 56 views
0

如何從下面重寫的URL中的查詢字符串中刪除%2F使用htaccess從查詢字符串中刪除%2F

這是我的.htaccess文件...

RewriteCond %{HTTP_HOST} ^test\.example\.com$ [NC] 
RewriteRule^http://www.example.com/?retailcentre=test$1%{REQUEST_URI} [QSA,NE,R=301,L] 

推薦網址...

http://test.example.com/?utm_source=email&utm_medium=email&utm_campaign=022641ReservedEventCustomerEmail 

上方,然後重定向到這個URL重寫...

http://www.example.com/?retailcentre=test%2F&utm_source=email&utm_medium=email&utm_campaign=022641ReservedEventCustomerEmail 

你可以看到它在需要刪除的retailcentre=test之後添加%2F

回答

0
RewriteEngine on 
RewriteCond %{HTTP_HOST} ^test\.example\.com$ [NC] 
RewriteRule^http://www.example.com%{REQUEST_URI}retailcentre=test [QSA,NE,R=301,L] 
+0

它從URL – Amesey

+1

刪除'%2F'它可能是,但retailcentre'查詢參數的'值已從問題完全改變 – anubhava

+0

感謝察覺這一點,我現在已經修改答案。 – Amesey