Redirect Subdomain URL to another SubDomain in IIS

后端 未结 2 1786
情书的邮戳
情书的邮戳 2021-02-15 15:37

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 pie

2条回答
  •  悲哀的现实
    2021-02-15 16:31

    Your rule is causing a redirect loop.

    Observe what your rule does:

    • Match any given URL (this includes "/", "/something", "/something/another.html", etc.)
    • If the host name ISN'T "report.usapartners.com"
    • Redirect permanently the request to "http://reporting.usapartners.com"

    So, as you see, as soon as the user is redirected to the reporting subdomain, it gets redirected again to reporting, because hostname isn't "report.usapartners.com".

    The key here is the negate="true" attribute on the rule condition. Remove it or set it to false and you are good to go.

    Edit:

    You are almost there.

    The real solution would be to change the host name on the rule to the desired host, keeping the negate true, so your rule would do:

    • Match any given URL (this includes "/", "/something", "/something/another.html", etc.)
    • If the host name ISN'T "reporting.usapartners.com"
    • Redirect permanently the request to "http://reporting.usapartners.com"

    Code:

    ...
    
    ...
    

提交回复
热议问题