Can IIS be configured to serve different sites depending on the ip of the incoming connection?
772
I'm looking to serve a "Work in progress" page to most of the internet, while allowing access to the site itself from a few specific, test, ip addresses.
Is this doable with IIS 7? How would you go about doing it?
www.website.com: No IP restrictions, "Work in progress" content
restricted.website.com: Appropriate IP restrictions, actual content
I would then have the root document (index.aspx, index.php, default.aspx, whatever), redirect users with the appropriate IP addresses, by using Request.UserHostName()(if .NET) or $_SERVER[REMOTE_ADDR](if PHP).
You can either utilize the IP and Domain Restrictions module, or download and install the URL Rewrite 2.0 module and use that. Here are 2 examples:
I would probably go with the following setup:
Using IP and Domain Restrictions
2 websites:
I would then have the root document (index.aspx, index.php, default.aspx, whatever), redirect users with the appropriate IP addresses, by using
Request.UserHostName()
(if .NET) or$_SERVER[REMOTE_ADDR]
(if PHP).Using URL Rewrite Module
A possible alternative, would be to use the URL Rewrite Module, to rewrite requests to the website, with the REMOTE_ADDR property as a condition.
This will automatically rewrite ALL requests NOT coming from the 4 predefined IP adresses, to /inprogress/default.aspx instead of the actual website