2016-09-06 55 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