Home > Software engineering >  IIS - Different Default Page based on inbound URL
IIS - Different Default Page based on inbound URL

Time:05-27

Hello my goal is to have users land on different pages on my domain based on the inbound url. This is IIS 10.0 hosted.

For example

  • test.mydomain.com would land at mydomain.com/test/version5/test.htm
  • production.mydomain.com would land at mydomain.com/production.htm

Not sure the best way to do this. Should I mess with DNS, a redirect, or is there some way to manipulate it in IIS?

CodePudding user response:

You can use url rewrite as suggested by Lex Li, this is the easiest way, I made a example for you that you can use as a reference, your two redirects have nothing in common, so you need to create 2 different rules.

<rule name="test1" stopProcessing="true">
   <match url=".*" />
     <conditions>
        <add input="{HTTP_HOST}" pattern="(.*)\.mydomain\.com" />
     </conditions>
   <action type="Redirect" url="mydomain.com/{C:1}/version5/test.htm" />
</rule>

<rule name="test2" stopProcessing="true">
   <match url=".*" />        
   <action type="Redirect" url="mydomain.com/production.htm" />
</rule>
  • Related