There was a problem loading the comments.

How to redirect your non www site to www

Support Portal  »  Knowledgebase  »  Viewing Article

  Print
To perform a redirection, you will have to do it via the .htaccess file and place it in the directory it is being run.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourdomain.com [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [L,R=301]

and if you want to to redirect to https

RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourdomain.com [NC]
RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [L,R=301]

Share via

Related Articles

© DirectHosting