Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We have two sites in IIS7 both on port 80. One is our actual website (MAIN) the other is a maintenance site (MAINTENANCE) that we start (and stop the other one) when we are deploying a new version of MAIN.

When we put MAINTENANCE live, if you browse to one of our subfolders (i.e. http://maintenance/product1) you'll get a 404. I want to use the URL Rewrite module to redirect to the root of the site (http://maintenance/).

I can get this working in a basic manner, but the image and css are not working. In other attempts I have ended up with a continual redirect.

Is this possible?

share|improve this question
up vote 2 down vote accepted

For anyone who arrives here via Google, I managed to get it to work with the following rule:

        <clear />
        <rule name="Force HTTP" stopProcessing="true">
            <match url="(.*)" />
            <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                <add input="{HTTPS}" pattern="on" />
            <action type="Redirect" url="/{R:1}" redirectType="Temporary" />
        <rule name="Allow Local Resources" stopProcessing="true">
            <match url=".*" />
            <conditions logicalGrouping="MatchAny" trackAllCaptures="false">
                <add input="{REQUEST_FILENAME}" pattern="SiteMaintenance.png" />
                <add input="{REQUEST_FILENAME}" pattern="Stylesheet.css" />
            <action type="None" />
        <rule name="Check Is Root" stopProcessing="true">
            <match url="^.+$" negate="false" />
            <conditions logicalGrouping="MatchAny" trackAllCaptures="false" />
            <action type="Redirect" url="/" appendQueryString="false" redirectType="Temporary" />

No idea if this is the best way, but it worked for me.


share|improve this answer

Your Answer


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.