0

这是我的 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>

如您所见,我有两个不同的规则会影响同一个 URL。基本上第二个条件根本不起作用。是否可以将不同的规则关联到同一个 url?

4

1 回答 1

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>

现在两者都应该工作。

于 2014-10-21T13:18:04.500 回答