How do I force all visitors to use the www. of the domain?
- Written by iracks
- Published in General
- Leave a reply
- Permalink
o force all website visitors to use the www. part of the domain in the URL (useful for search engines) you can put the following into a .htaccess file:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^domain.com$
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
Replace domain.com with your actual domain name.
After doing this, anyone who enters http://example.com into the browser will be redirected to http://www.example.com