繁体   English   中英

使用查询字符串将web.config重定向到另一个域

[英]web.config redirection with query string to another domain

我在我的网站上有当前位置:

http://my-domain.com/ccy/app.html?from=GBP&to=EUR...

并且我想使用web.config将对/ccy文件夹的所有调用重定向到包含相同查询字符串的另一个域,所以去了。

http://my-other-domain.com/another-folder/app.html?from=GBP&to=EUR

使用IIS7如何实现?

提前致谢

您可以在IIS 7中使用“ URL重写”模块 。以下规则适用于您的情况:

<system.webServer>
  <rewrite>
    <rules>
      <rule name="DynamicRewrite" stopProcessing="true">
        <match url="ccy/(.*)" />
        <conditions>
          <add input="{REQUEST_FILENAME}\.html" matchType="IsFile" />
        </conditions>
        <action type="Redirect" url="http://my-other-domain.com/another-folder/{R:1}.html" />
      </rule>
    </rules>
  </rewrite>  
</system.webServer>

您可能想使用mod rewrite将对ccy的所有请求重写到另一个文件夹。

这是一个涵盖IIS7的mod重写的链接。

http://www.micronovae.com/ModRewrite/ModRewrite.html

暂无
暂无

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

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