SEO using .htaccess
An htaccess file is a simple ASCII file or SimpleText.
.htaccess is the file extension. It is not file.htaccess or somepage.htaccess, it is simply named .htaccess
It is a good Practice to pick your preferred domain to redirect one to the other via htaccess, to prevent search engine robots to treat your site as a duplicate content.
Using htaccess to redirect WWW to non-WWW site or vice versa
Example 1 - Redirect www.domain.com to domain.com
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^domain.com$ [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [L,R=301]
Example 2 - Redirect domain.com to www.domain.com
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]















Be The First To Comment
Related Post
Please Leave Your Comments Below