【发布时间】:2012-02-07 19:56:42
【问题描述】:
我一直在关注http://learn.iis.net/page.aspx/806/seo-rule-templates/,这是在 IIS7 中创建 SEO 友好 URL 的近乎完美的指南。
我有一个问题:
如果我创建一个规则来重写www.domain.com/contact/,我会进入 web.config:
<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="?p={R:1}" />
</rule>
但是我不能这样做www.domain.com/contact/send/。
如果我创建一个规则来重写www.domain.com/contact/send/,我会进入 web.config:
<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="?p={R:1}&a={R:2}" />
</rule>
但是我不能这样做www.domain.com/contact/
这两条规则都是为了让我在我的/scripts/、/css/ 和/images/ 文件夹中看不到任何脚本、css og 图像。
我如何制定规则以匹配 AND 不匹配上述 3 个文件夹?
【问题讨论】:
标签: iis iis-7 url-rewriting web-config