简体   繁体   English

Windows IIS 重定向另一个站点

[英]Windows IIS redirect another site

I have two sites called test1 and test2 in IIS我在 IIS 中有两个名为 test1 和 test2 的站点
I want http://update.xxx.com/ assıgn to test1 http://update.xxx.com/test2 assıgn to test2我想要http://update.xxx.com/ assıgn to test1 http://update.xxx.com/test2 assıgn to test2

how can i do it ?我该怎么做 ? ı tried url rewrite but it didn't work for me我尝试过 url 重写,但对我不起作用

Did you get 404.4 error?您收到 404.4 错误了吗? I have two website site1 and site2我有两个网站 site1 和 site2 在此处输入图片说明

1.If you want to access your test1 via update.xxx.com from external network. 1.如果您想从外部网络通过update.xxx.com访问您的test1。 Then you have to purchase a public domain and map it to your server's public ip address.然后您必须购买一个公共域并将其映射到您服务器的公共IP地址。

If your server is just hosted in Active directory, then you need to create a primary forward lookup zone named xxx.com Then add a CNAME update for your server's A record(HOST).如果您的服务器仅托管在 Active Directory 中,那么您需要创建一个名为xxx.com的主要正向查找区域,然后为您服务器的 A 记录(HOST)添加 CNAME 更新。 Then its FQDN will be update.xxx.com .那么它的 FQDN 将是update.xxx.com You also need to register a CNAME for your site2 like update2.xxx.com您还需要为您的站点 2 注册一个 CNAME,例如 update2.xxx.com

2.You need to set IIS binding for your site1. 2.您需要为您的站点1设置IIS绑定。 在此处输入图片说明

  1. Create binding for your site2.为您的站点 2 创建绑定。 Please ensure both site1 and site2 can be accessed from domain name.请确保可以从域名访问 site1 和 site2。

在此处输入图片说明

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

5.Open IIS manager server node->application request routing cache->Server proxy settings->Enable proxy. 5.打开IIS管理器服务器节点->应用请求路由缓存->服务器代理设置->启用代理。

6.Create a URL rewrite in site1 like this: 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>

Now when you access update.xxx.com/test2, it will go to site2.现在,当您访问 update.xxx.com/test2 时,它将转到 site2。

If you don't have multiple domain, then you could just share same IP with different port in binding.如果您没有多个域,那么您可以在绑定中使用不同的端口共享相同的 IP。

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

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