我有一个用 db 提供的 asp 和 url 重写规则的站点。我工作正常,但我有一个烦人的问题,我无法正确解决。改写后的规则如下:
www.mydomain.com/default.asp --> www.mydomain.com/lang
www.mydomain.com/content.asp?id=1 --> www.mydomain.com/lang/category-title
www.mydomain.com/content.asp?id=1&ref=2 --> www.mydomain.com/lang/category-title/content-title
规则是:
<rules>
<clear />
<rule name="dbp_Redirect" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{DB:{R:1}?{QUERY_STRING}}" pattern="(.+)" />
</conditions>
<action type="Redirect" url="{C:1}" appendQueryString="false" logRewrittenUrl="false" />
</rule>
<rule name="dbp_Reverse" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{DB_rewrite:{R:1}}" pattern="(.+)" />
</conditions>
<action type="Rewrite" url="{C:1}" logRewrittenUrl="false" />
</rule>
</rules>
<outboundRules>
<clear />
<rule name="Outbounddbp_Reverse" preCondition="ResponseIsHtml1" enabled="true">
<match filterByTags="A" pattern="^(.*/)(.*)" ignoreCase="true" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="true">
<add input="{DB_outbound:{R:2}}" matchType="Pattern" pattern="(.+)" ignoreCase="true" negate="false" />
</conditions>
<action type="Rewrite" value="{C:0}" />
</rule>
<preConditions>
<preCondition name="ResponseIsHtml1">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
</preCondition>
</preConditions>
</outboundRules>
问题是当用户到达
www.mydomain.com/lang/category-title/content-title
page 所有在这个页面中重写的链接是这样的:
www.mydomain.com/lang/category-title/content-title/*lang/category-title/content-title*
(如您所见,“ lang/category-title/content-title
”重复了两次)
当然,我在规则中遗漏了一些东西,但我看不到它是什么。
任何帮助,将不胜感激。