If you wish to redirect your domain from non-www to www, place following code to your .htaccess file which you can find from your domain's root directory:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.your-domain-goes-here.com/$1 [R=301,L]


If you wish to redirect your domain from www to non-www, place following code to your .htaccess file:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.
RewriteRule ^(.*)$ https://your-domain-goes-here.com/$1 [R=301,L]


If RewriteEngine On already exists in your .htaccess file, you may remove it.

This example uses https:// protocol. If your domain does not use https, change it to http://
Was this article helpful?
Cancel
Thank you!