I need help with writing a URL Redirect rule on IIS 7.5
I need to create a rule so if someone visits the site this-sub.example.com/anything
then he would be redirected to the example.com
page.
<rule name="My redirection home">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^this-sub.example.com/*.*" />
</conditions>
<action type="Redirect" url="http://example.com" appendQueryString="false" redirectType="Permanent" />
</rule>
instead of redirecting this-sub.example.com/anything
to example.com
it redirects to example.com/anything
. It keeps the anything
part. I have also URL Rewrite module installed.
This rule will redirect everything from this-sub.example.com
to example.com
<rule name="My redirection home" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^this-sub\." />
</conditions>
<action type="Redirect" url="http://example.com" appendQueryString="false" redirectType="Permanent" />
</rule>