To avoid search engines indexing your site under the www record and non www record, you can redirect the non www record to the www record. From a user point of view this means that when I browse to domainname.com, I am redirected to www.domainname.com.
- Create a .htaccess file
- Add the following lines to it, replacing domainname.com with your domain name:
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domainname.com [NC]
RewriteRule ^(.*)$ http://www.domainname.com/$1 [L,R=301]
- Place this in your webroot folder
You can use this to also redirect domainname.com to any-other-address.com if you want, just replace http://www.domainname.com/ with the URL you want domainname.com to point to.
Comments
0 comments
Article is closed for comments.