htaccess querystring通配符匹配

时间:2015-08-04 12:18:02

标签: .htaccess

请再次帮助......

我的htaccess文件就像......

RewriteCond %{QUERY_STRING} ^search=(.*)$
RewriteRule ^search_results.asp$ /search/?s=%1 [R=301,L,NC]

这适用于:     http://dev.domain.com/search_results.asp?search=tile

但是如果“search =”之后还有其他内容,我也需要它才能工作 - 例如     http://dev.domain.com/search_results.asp?search=tile&page=1&sortby=a

具体来说,我需要忽略其他任何事情......

附加参数的数量是可变的,所以我可以使用通配符吗?

1 个答案:

答案 0 :(得分:2)

您可以使用:

RewriteCond %{QUERY_STRING} search=(.*?)(&|$) [NC]
RewriteRule ^search_results\.asp$ /search/?s=%1 [R=301,L,NC]
相关问题