URL重写 - htaccess web.config

时间:2012-05-30 09:22:45

标签: .htaccess url-rewriting web-config

我在IIS中导入了这些重写规则:

RewriteRule ^search/(.+)/([0-9]+)?$ search.html?name=$1&page=$2 [QSA,L]
RewriteRule ^search/(.+)?$ search.html?name=$1&page=1 [QSA,L]

翻译是:

match url="^search/(.+)/([0-9]+)?$" ignoreCase="false"
action type="Rewrite" url="search.html?name={R:1}&page={R:2}" appendQueryString="true"

match url="^search/(.+)?$" ignoreCase="false"
action type="Rewrite" url="search.html?name={R:1}&page=1" appendQueryString="true"

但是当我测试不起作用时

HTTP错误404.0 - 未找到 - 这是错误

1 个答案:

答案 0 :(得分:0)

尝试使用条件,

条件logicalGrouping =“MatchAll”trackAllCaptures =“false”

(不包括开始和结束标签。)