这是我的UrlRewritingnet配置文件:
<urlrewritingnet xmlns="http://www.urlrewriting.net/schemas/config/2006/07">
<rewrites>
<add name="paginazioneLibri" virtualUrl="^~/home/library/(.[0-9]*){1,3}" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/home/library?page=$1" ignoreCase="true" redirectMode="Permanent" />
<add name="categorieLibri" virtualUrl="^~/home/library/category/(.[0-9]*)" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/home/library?cat=$2" ignoreCase="true" redirectMode="Permanent" />
</rewrites>
正如您所看到的,我有两个不同的规则会影响同一个网址。基本上第二个条件根本不起作用。是否可以将不同的规则关联到同一个网址?
答案 0 :(得分:1)
尝试像这样切换它们:
<rewrites>
<add name="categorieLibri" virtualUrl="^~/home/library/category/(.[0-9]*)" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/home/library?cat=$2" ignoreCase="true" redirectMode="Permanent" />
<add name="paginazioneLibri" virtualUrl="^~/home/library/(.[0-9]*){1,3}" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/home/library?page=$1" ignoreCase="true" redirectMode="Permanent" />
</rewrites>
现在两者都应该有用。