I have IIS 8 and I need redirect only localhost requests to one page to another page on the same IIS.

I tried it with URL Rewrite module and Conditions but maybe this is wrong way...



I finally find an answer. It has to be done on the root of the sites - like "Default Web Site". And the web sites must have same application pool. If not, error page 403 will show up.

       <directoryBrowse enabled="true" />
               <rule name="RemoveDevices.aspx" enabled="true">
                   <match url="(.*/)Website/(Demo\.aspx)" />
                       <add input="{REMOTE_ADDR}" pattern="127\.0\.0\.1" negate="true" /> 
                       <add input="{REMOTE_ADDR}" pattern="10\.15\.1\.95" negate="true" /> <!--IP ADDRESS OF YOUR SERVER-->
                       <add input="{REMOTE_ADDR}" pattern="CZ-DEV095\.develop.local" negate="true" /> <!--HOST NAME OF YOUR SERVER-->
                       <add input="{HTTP_HOST}" pattern="localhost" negate="true" />
                   <action type="Rewrite" url="{R:1}NEW_SITE/{R:2}" logRewrittenUrl="true" />
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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