To auto redirect permanently for non www URLs to the www equivalent and retain the http(s) protocol you can add the following ot your web.config
NOTE : You should replace sitename.com with your own domain name.
<system.webServer>
<rewrite>
<rules>
<rule name="Redirect to www" stopProcessing="true">
<match url="(.*)" />
<conditions trackAllCaptures="false">
<add input="{HTTP_HOST}" pattern="^sitename.com$" />
</conditions>
<action type="Redirect" url="{MapProtocol:{HTTPS}}://www.{HTTP_HOST}{HTTP_URL}" redirectType="Permanent"/>
</rule>
</rules>
<rewriteMaps>
<rewriteMap name="MapProtocol">
<add key="on" value="https" />
<add key="off" value="http" />
</rewriteMap>
</rewriteMaps>
</rewrite>
</system.webServer>
2025 © Nutty About Hosting. All Rights Reserved. Privacy Policy | Terms and Conditions | GDPR | Partners | Green Hosting
Follow us on Twitter to receive updates regarding network issues, discounts and more. All prices exclude VAT.