Redirect a site with or without www
Updated 5 days ago
If you want all visits to your site to always use the version with www (or without it), you need to edit the *.htaccess file located in the public_html* root folder.
To force your site's URL to use WWW, add:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^dominio.com [NC]
RewriteRule ^(.*)$ http://www.dominio.com/$1 [L,R=301,NC]To force your URL to use no WWW, add:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.dominio.com [NC]
RewriteRule ^(.*)$ http://dominio.com/$1 [L,R=301]IMPORTANT NOTE: remember to replace "dominio.com" (in both the second and third lines of each case) with your website's actual URL.
After applying the change, test the addresses with and without www using the HostingFAQ redirect checker. Check the HTTP code, the redirects, and the final address to confirm they reach the version you chose.
Was this helpful?
Was this helpful?