如何解决子域URL重写问题
| 我已经为这个问题挠头了至少两个月。我在我们的网站上有一个分类广告部分,其中包含SEO友好的URL,我想重写这些URL。我不确定问题是否与每个区域的子域有关。该URL可能如下所示: 这些是有效的网址: http://milwaukee.storeboard.com/classifieds/for-sale/business/make-incredible-income-while-growing-your-local-economy/425 我想使其转到我们服务器上的该地址: 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重写。
我非常感谢您可以提供的任何帮助
解决方法
尝试以下规则
<rule name=\"Classifieds Ad\" stopProcessing=\"true\">
<match url=\"^classifieds/.*?/(\\d+)$\" />
<conditions>
<add input=\"{HTTP_HOST}\" type=”Pattern” pattern=\"^(.*)$\">
</conditions>
<action type=\"Rewrite\" url=\"{C:0}/classifieds/viewad.asp?ClassAdID={R:1}\" />
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。