301 Redirect non WWW. URLs to WWW. Urls
Aug 11
First of all why you should have consistent www or non www URL.
- Keep your address unique and don’t loose any traffic.
- It’s SEO best practice to prevent canonicalization problems. Search engines will consider www and non www address as two different sub domains and as content will be found same on both of them so they will penalize the website for duplicate content.
301 Redirect non WWW. to WWW. Method 1:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example\.com
RewriteRule ^(.*)$ http://www.example.com/$1 [R=permanent,L]
301 Redirect non WWW. to WWW. Method 2:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
301 Redirect from WWW. to non WWW domain address
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^example\.com
RewriteRule (.*) http://example.com/$1 [R=301,L]
