Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

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:

  1. www.website.com: No IP restrictions, "Work in progress" content
  2. 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).

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.

<rule name="ip-rewrite" stopProcessing="true">
  <match url="website.com" />
  <conditions logicalGrouping="MatchAny">
    <add input="{REMOTE_ADDR}" pattern="127.0.0.1" negate="true" />
    <add input="{REMOTE_ADDR}" pattern="123.55.44.16" negate="true" />
    <add input="{REMOTE_ADDR}" pattern="23.34.48.8" negate="true" />
    <add input="{REMOTE_ADDR}" pattern="201.0.245.13" negate="true" />
  </conditions>
  <action type="Rewrite" url="http://www.website.com/inprogress/default.aspx" appendQueryString="false" />
</rule>

This will automatically rewrite ALL requests NOT coming from the 4 predefined IP adresses, to /inprogress/default.aspx instead of the actual website

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.