将子域URL重定向到IIS中的另一个子域 [英] Redirect Subdomain URL to another SubDomain in IIS

查看:117
本文介绍了将子域URL重定向到IIS中的另一个子域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将假"子域重定向到IIS 7.5中的真实子域.原因是市场部不想在印刷件中使用实际的网站地址.

I need to redirect a "fake" sub domain to a real subdomain in IIS 7.5. The reason is that the marketing department doesn't want to use the actual website address in print pieces.

实际网站网址:

reporting.usapartners.com

reporting.usapartners.com

营销部门想要 report.usapartners.com(伪造)以重定向到 reporting.usapartners.com(真实)

Marketing dept wants report.usapartners.com (fake) to redirect to reporting.usapartners.com (real)

同样,report.usapartners.com不存在,只有reporting.usapartners.com存在

Again, report.usapartners.com does not exist, only reporting.usapartners.com exists

这是我尝试过的

我在IIS中为网站report.usapartners.com添加了绑定.我添加了report.usapartners.com作为主机名,并使用了report.usapartners.com IP地址

I added a binding in IIS, for the site reporting.usapartners.com. I added report.usapartners.com as the host name and used the reporting.usapartners.com IP address

然后我进入了report.usapartners.com web.config并添加了以下内容:

Then I went into reporting.usapartners.com web.config and added this:

<rewrite>
    <rules>
        <rule name="report" stopProcessing="true">
          <conditions logicalGrouping="MatchAll">
            <add input="{HTTP_HOST}" pattern="report.usapartners.com" negate="false" />
          </conditions>
          <action type="Redirect" url="http://reporting.usapartners.com" appendQueryString="false" redirectType="Permanent" />
        </rule>
    </rules>
</rewrite>

好像我的解决方案创建了一个无法重定向到的别名.

Looks like my solution creates an alias that cannot be redirected to.

我什至正确地解决了这个问题吗?似乎应该解决一个简单的问题,但也许不是吗?任何想法都受到欢迎和赞赏.

Am I even approaching this problem correctly? Seems like it should be a simple problem to solve but perhaps not? Any ideas are welcomed and appreciated.

谢谢

推荐答案

我认为您需要为IIS中的report.usapartners.com(假站点)创建一个具有主机绑定的单独站点.这将是一个存根站点(它仍需要磁盘上的路径,但只在其中有一个web.config),它将仅托管一个重定向规则.

I think you need to create a separate site with host bindings for report.usapartners.com (the fake site) in IIS. This is going to be a stub site (it will still need a path on the disk, but it's only going to have a web.config in there) which will just host a redirect rule.

现在在IIS中单击该站点的HTTP Redirect,然后勾选Redirect requests to this destination,然后在文本框中输入http://reporting.usapartners.com.然后勾选Redirect all requests to exact destination (instead of relative to destination),不要勾选下一个,然后选择状态码Permanent (301).

Now click on HTTP Redirect for that site in IIS and tick Redirect requests to this destination and put http://reporting.usapartners.com in the textbox. Then tick Redirect all requests to exact destination (instead of relative to destination), don’t tick the next one and then choose Status Code Permanent (301).

如果您希望它重定向并保留子目录和/或查询字符串,则可以将文本框的内容更改为http://reporting.usapartners.com$S$Q.请注意,在这种情况下,没有斜杠. $S保留子目录,而$Q保留查询字符串.

If you want it to redirect and keep the subdirectories and/or query string, then you can change the contents of the textbox to be http://reporting.usapartners.com$S$Q. Note that there is no trailing slash in this case. The $S preserves the sub directories and the $Q preserves the query string.

这篇关于将子域URL重定向到IIS中的另一个子域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆