【发布时间】:2012-02-10 11:52:24
【问题描述】:
至少两个月以来,我一直在为这个问题摸不着头脑。我在我们的网站中有一个分类广告部分,其中包含 SEO 友好的 URL,我想重写这些 URL。我不确定问题是否与每个区域的子域有关。 URL 可能如下所示:
这些是有效的 URL:
我想让它转到我们服务器上的这个地址:
http://milwaukee.storeboard.com/classifieds/viewad.asp?ClassAdID=425
我在 web.config 文件中使用以下代码...但无论我尝试什么变体,我都无法让它工作..
<rule name="Classifieds Ad" stopProcessing="true">
<match url="^http://([^/]+)/classifieds/.*?(\d+)$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="http://{R:1}/classifieds/viewad.asp?ClassAdID={R:2}" />
此时第一个链接有效的唯一原因是因为我正在使用我的 404 错误页面来处理请求,然后通过 MSXML2.ServerXMLHTTP.6.0 调用该页面,但这是不可靠的并且可能会超时,尤其是在繁忙的时候用法。我想删除此方法并使用快速 IIS URL 重写。
非常感谢您能提供的任何帮助
【问题讨论】:
标签: iis url-rewriting