我有以下 web.config URL 重写规则:
<rule name="RedirectUserFriendlyURL1" stopProcessing="true">
<match url="^propertysearch\.asp$" />
<conditions>
<add input="{REQUEST_METHOD}" pattern="^POST$" negate="true" />
<add input="{QUERY_STRING}" pattern="^urlrewrite=([^=&]+)$" />
</conditions>
<action type="Redirect" url="{C:1}" appendQueryString="false" />
</rule>
<rule name="RewriteUserFriendlyURL1" stopProcessing="true">
<match url="^([^/]+)/?$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="propertysearch.asp?urlrewrite={R:1}" />
</rule>
问题是它将它应用于所有内容,所以我想要做的是更改匹配 url 语法以告诉它仅在 URL 中包含“-to-rent-in-”时运行,所以......
www.domain.com/villas-to-rent-in-florida
将有资格并应用规则,但这不会
www.domain.com/testentry
我尝试了不同的变体,但它一直遇到错误:(