Redirect file to URL IIS

With this rewrite rule in your web.config, it’s possible to redirect a user from a specific file to an internal or external URL.
When they enter http://domain.com/folder/filename.html, they will be redirected to http://www.google.com

Note that this requires you have URL Rewrite installed on your IIS.

Place the following rule inside:
[xml]
<system.webServer>
<rewrite>
<rules>

Your rule goes here…

</rule>
</rules>
</rewrite>
</system.webServer>
[/xml]

Rewrite rule:
[xml]
<rule name="Redirect file to external url" stopProcessing="true">
<match url="^~/folder/filename\.html$" />
<conditions>
<add input="{REQUEST_METHOD}" pattern="^POST$" negate="true" />
</conditions>
<action type="Redirect" url="http://www.google.com" appendQueryString="false" redirectType="Permanent" />
</rule>
[/xml]