简体   繁体   English

子域 URL 重写问题

[英]Sub-Domain URL Rewrite Issues

I have been scratching my head with this problem for at least two months.至少两个月以来,我一直在为这个问题挠头。 I have a classified ads section in our site which has SEO friendly URL's I want to rewrite these url's.我在我们的网站上有一个分类广告部分,其中有 SEO 友好的 URL,我想重写这些 URL。 I am not sure if the problem is related to the subdomain for each region.我不确定问题是否与每个区域的子域有关。 The URL may look like this: URL 可能如下所示:

These are working URL's:这些是有效的 URL:

http://milwaukee.storeboard.com/classifieds/for-sale/business/make-incredible-income-while-growing-your-local-economy/425 http://milwaukee.storeboard.com/classifieds/for-sale/business/make-incredible-income-while-growth-your-local-economy/425

I want to make it goto this address on our server:我想让它转到我们服务器上的这个地址:

http://milwaukee.storeboard.com/classifieds/viewad.asp?ClassAdID=425 http://milwaukee.storeboard.com/classifieds/viewad.asp?ClassAdID=425

I am using the following code in the web.config file... but no matter what variations I try I cant get it to work..我在 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}" />

The only reason the first link works at this time is because I am using my 404 error page to process the request and then calling the page via MSXML2.ServerXMLHTTP.6.0 but this is unreliable and can timeout, especially during times of heavy usage.第一个链接此时有效的唯一原因是因为我使用我的 404 错误页面来处理请求,然后通过 MSXML2.ServerXMLHTTP.6.0 调用该页面,但这不可靠并且可能超时,尤其是在大量使用时。 I want to remove this method and use the quick IIS URL Rewrite.我想删除此方法并使用快速 IIS URL 重写。

I would really appreciate any help you can provide我非常感谢您能提供的任何帮助

Try the below rule试试下面的规则

<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}" />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM