I want to redirect non-www urls to www url for both http and https . I tried following rules in web.config but not working.
please help
<rewrite>
<rules>
<!-- For force ssl -->
<rule name="Redirect to WWW" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^domain.com$" />
</conditions>
<action type="Redirect" url="http://www.domain.com/{R:0}" redirectType="Permanent" />
</rule>
<!-- For force ssl -->
<!-- For force www -->
<rule name="Redirect to WWW https" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTPS}" pattern="^domain.com$" />
</conditions>
<action type="Redirect" url="https://www.domain.com/{R:0}" redirectType="Permanent" />
</rule>
<!-- For force www -->
</rules>
</rewrite>
<!-- For force ssl and www -->
Anonymous User
15-Jun-2018In the web.config inside <system.webServer> code here.... </system.webServer> section of your web.config add the following lines of:
i hope it will help to you.