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.
<configuration>
<system.webServer>
<directoryBrowse enabled="true" />
<rewrite>
<rules>
<rule name="RemoveDevices.aspx" enabled="true">
<match url="(.*/)Website/(Demo\.aspx)" />
<conditions>
<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" />
</conditions>
<action type="Rewrite" url="{R:1}NEW_SITE/{R:2}" logRewrittenUrl="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>