简体   繁体   中英

Windows IIS redirect another site

I have two sites called test1 and test2 in IIS
I want 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

Did you get 404.4 error? I have two website site1 and site2 在此处输入图片说明

1.If you want to access your test1 via update.xxx.com from external network. Then you have to purchase a public domain and map it to your server's public ip address.

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). Then its FQDN will be update.xxx.com . You also need to register a CNAME for your site2 like update2.xxx.com

2.You need to set IIS binding for your site1. 在此处输入图片说明

  1. Create binding for your site2. Please ensure both site1 and site2 can be accessed from domain name.

在此处输入图片说明

4.Please install Application request routing for your IIS server. https://www.iis.net/downloads/microsoft/application-request-routing

5.Open IIS manager server node->application request routing cache->Server proxy settings->Enable proxy.

6.Create a URL rewrite in site1 like this:

  <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.

If you don't have multiple domain, then you could just share same IP with different port in binding.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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