Here is rules to redirect website to website.com to www.website.com
Also if your website running in both http and https then you can write rules as per below.
<rule name="Redirect http" patternSyntax="ECMAScript" stopProcessing="true">
<match url=".*"></match>
<conditions>
<add input="{HTTP_HOST}" pattern="^website.com$"></add>
</conditions>
<action type="Redirect" url="http://www.website.com/{R:0}" redirectType="Permanent" appendQueryString="true"></action>
</rule>
<rule name="Redirect https" patternSyntax="ECMAScript" stopProcessing="true">
<match url=".*"></match>
<conditions>
<add input="{HTTPS}" pattern="https://website.com$"></add>
</conditions>
<action type="Redirect" url="https://www.website.com/{R:0}" redirectType="Permanent" appendQueryString="true"></action>
</rule>
Also if your website running in both http and https then you can write rules as per below.
<rule name="Redirect http" patternSyntax="ECMAScript" stopProcessing="true">
<match url=".*"></match>
<conditions>
<add input="{HTTP_HOST}" pattern="^website.com$"></add>
</conditions>
<action type="Redirect" url="http://www.website.com/{R:0}" redirectType="Permanent" appendQueryString="true"></action>
</rule>
<rule name="Redirect https" patternSyntax="ECMAScript" stopProcessing="true">
<match url=".*"></match>
<conditions>
<add input="{HTTPS}" pattern="https://website.com$"></add>
</conditions>
<action type="Redirect" url="https://www.website.com/{R:0}" redirectType="Permanent" appendQueryString="true"></action>
</rule>
No comments:
Post a Comment