1

I have an Azure VM that is hosting a web application.

The application will be accessible via the VM's IP address:

http://191.238.112.62

I want to be able to use query strings to redirect to completely different sites that are within the local IIS. For example:

http://191.238.112.62/?site=1

would redirect to

www.site1.com

The way I have structured IIS can be seen below:

enter image description here

Each site has an entry in the systems host file.

127.0.0.1 wwww.site1.com
127.0.0.1 wwww.site2.com
127.0.0.1 wwww.site3.com

There is likely a better way to achieve what I am going for here so any pointers would be greatly appreciated.

Thanks.

krisFR
  • 13,280
  • 4
  • 36
  • 42

1 Answers1

0

Here is what i would do :

First, you need to download and install the URL Rewrite extension for IIS (A reboot, so a downtime, may be required to activate the extention).

You will need to update your DNS creating A or CNAME records for other web Sites, e.g :

www.site1.com. IN A 191.238.112.62
www.site2.com. IN A 191.238.112.62
www.site3.com. IN A 191.238.112.62

You will need a main entry site that will respond to http://191.238.112.62. Let use the "Default Web Site" for this. Configure the Bindings for this "Default Web Site" so that its Host Header is set to 191.238.112.62 :

enter image description here

You need to set the appropriate Host Header within the Binding for site1.com :

enter image description here

Enter the URL Rewrite module for "Default Web Site" and create a new rule :

enter image description here enter image description here enter image description here

You will need to uncheck "Append query string" to remove ?site=1 once redirected. Then "Apply".

Proceed the same way for other sites wwww.site2.com and wwww.site3.com

krisFR
  • 13,280
  • 4
  • 36
  • 42