我有这个代码片段,但它不起作用。显然加号 + 一定是转义符吗?
RewriteCond %{QUERY_STRING} ^orderby=position&controller=search&orderway=desc&search_query=t+max$
RewriteRule ^it/cerca$ http://www.wrs.sm/it/cerca?orderby=position&controller=search&orderway=desc&search_query=tmax? [R=301,L]
我想重定向这个网址
http://www.wrs.sm/it/cerca?orderby=position&controller=search&orderway=desc&search_query=t+max
对此
http://www.wrs.sm/it/cerca?orderby=position&controller=search&orderway=desc&search_query=tmax
谢谢 ;)
我找到了解决方案,正确的规则是:
RewriteCond %{QUERY_STRING} ^orderby=position&controller=search&orderway=desc&search_query=t\+max$
RewriteRule ^it/cerca$ http://www.wrs.sm/it/cerca?orderby=position&controller=search&orderway=desc&search_query=tmax [R=301,L]
答案1
RewriteCond %{REQUEST_URI} ^/it/cerca$
RewriteCond %{QUERY_STRING} orderby=position&controller=search&orderway=desc&search_query=t+max
RewriteRule (.*) http://www.wrs.sm/it/cerca?orderby=position&controller=search&orderway=desc&search_query=tmax [R,L]
这或许是一个很好的起点。