Windows IIS重定向另一个站点

问题描述 投票:0回答:1

我在IIS中有两个站点分别称为test1和test2,我想要http://update.xxx.com/关联到test1 http://update.xxx.com/test2关联到test2,我该怎么办? ı尝试重写网址,但对我不起作用

windows iis windows-server-2012-r2 windows-server
1个回答
0
投票

您收到404.4错误吗?我有两个网站site1和site2enter image description here

1。如果要从外部网络通过update.xxx.com访问test1。然后,您必须购买一个公共域并将其映射到服务器的公共IP地址。

如果服务器仅托管在Active Directory中,则需要创建一个名为xxx.com]的主正向查找区域,然后为服务器的A记录(HOST)添加CNAME更新。然后其FQDN将为update.xxx.com。您还需要为site2注册一个CNAME,例如update2.xxx.com

2。您需要为站点设置IIS绑定1。enter image description here

  1. 为您的站点创建绑定2。请确保可以从域名访问site1和site2。
  2. enter image description here

4。请为您的IIS服务器安装应用程序请求路由。https://www.iis.net/downloads/microsoft/application-request-routing

5。打开IIS管理器服务器节点->应用程序请求路由缓存->服务器代理设置->启用代理。

6。像这样在site1中创建URL重写:

  <rule name="rewrite" enabled="true" stopProcessing="true">
                    <match url="^test2(.*)" />
                    <conditions>
                        <add input="{HTTP_HOST}" pattern="update.xxx.com" />
                    </conditions>
                    <action type="Rewrite" url="http://update2.xxx.com{R:1}" />
                </rule>

现在访问update.xxx.com/test2时,它将转到site2。

如果您没有多个域,则可以在绑定中与其他端口共享同一IP。

© www.soinside.com 2019 - 2024. All rights reserved.