我有很多参数的网址,这是一个如下所示的示例:
http://www.mysite.com/profile?reset=1&force=1&gid=9&custom_18=BS+Forestry%2C+University+of+Kentucky
我想做一个RewriteRule,重定向包含字符串的任何请求:
&custom
到静态HTML页面,例如:
http://www.mysite.com/foo.html
有人可以告诉我这是否可行?
非常感谢!
答案 0 :(得分:2)
这应该可以解决问题:
RewriteCond %{QUERY_STRING} (^|&)custom(&|$)
RewriteRule ^(.*)$ http://www.mysite.com/foo.html [R]