Contact us - real people, fast replies
Nutty About Hosting - Because We Care

How do I Redirect my Website to www

Last updated: 26 July 2026

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>