Menu

Umbraco auto redirect non www to www

Updated: August 8, 2011

Ali Taheri

Here’s how you can easily define a rule to redirect all non-WWW URLs to their WWW equivalent.

   ex: http://example.com --> http://www.example.com

All URLs of the site are automatically redirected to the right page.

   ex: http://example.com/contact-us --> http://www.example.com/contact-us

  1. Add the following code to UrlRewriting.config under config folder of Umbraco.
    <add name="301ReDirect_For_WWW_Domain"
         redirectMode="Permanent"
         redirect="Domain"
         ignoreCase="true" 
         rewriteUrlParameter="IncludeQueryStringForRewrite"
         virtualUrl="http://example.com/(.*)"
         destinationUrl="http://www.example.com/$1" />
     
  2. Replace http://example.com and http://www.example.com with your site's URL.

Tags

Umbraco
comments powered by Disqus

© 2017 - Ali Sheikh Taheri