如何从网址末尾删除查询字符串? 更具体地说,这是我的重写规则:
RewriteRule example-(.*).html$ examples/view-example.php?param1=parameter¶m2=$1&split=-
我想让它返回404或重定向到www.mydomain.com/example-one.html
:
www.mydomain.com/example-one.html?param1=parameter¶m2=one&split=-
这是我试过的,它不起作用:
RewriteCond %{REQUEST_URI} /examples/view-example\.php
RewriteCond %{QUERY_STRING} param1=parameter¶m2=(.*)&split=-
RewriteRule ^(.*)$ http://mydomain.com/example-%1.html$
我认为RewriteRule ^(.*)$ http://mydomain.com/example-%1.html$
不正确..
答案 0 :(得分:0)
这应该可以解决问题:
RewriteCond %{QUERY_STRING} ^param1=parameter¶m2=(.*)&split=-
RewriteRule ^/examples/view-example\.php$ http://mydomain.com/example-%1.html [R=301]
虽然,我不明白你想用www.mydomain.com/example-one.html?param1=parameter¶m2=one&split=-