我有这个:
http://www.example.com/pt/?id=114
...我需要将它重定向到这个:
http://www.example.com/pt
我当前无法运行的代码:
RewriteRule ^/pt$ /pt [L,R=301,QSD]
有什么帮助吗?
最佳答案
要删除查询字符串,您可以使用以下规则:
RewriteEngine on
RewriteCond %{QUERY_STRING} .
RewriteRule ^/?pt$ /pt? [L,R=301,L]
关于regex - 如何从 url 中删除查询字符串?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40271704/