How to redirect your non www site to www
- 2016-08-16 2:43 PM
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]