Skip to main content Help Control Panel

Login   A+   A-

Community «   Discussion forum «   Post your requirements here «  

More information
Recent files
Recent comments
AddThis Social Bookmark Button
AddThis Feed Button

SEO www redirects in htaccess (code included)

avatar
NickR
YACS team (UK)
How about this to help improve SEO. Will require hand editting to enable correct rule and domain name. I have this running my my site without problem.

Needs to be the first rewrite rule in the list.

# redirect all to http://www.example.com/...
#
RewriteCond %{HTTP_HOST} ^example.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
#
# redirect http://www.example.com/... to http://example.com/...
#
# RewriteCond %{HTTP_HOST} ^www.example.com$ [NC]
# RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]


:)
Bernard
avatar
from nearby-an-airport
Associate
6544 posts
registered on Sep. 12 2003

on Oct. 20 2007


Nick, i don't understand how this help SEO. Can you explain please?
NickR
avatar
from West Yorkshire, UK
Member
327 posts
registered on Aug. 17 2006

on Oct. 20 2007


Because they are different urls and google considers it duplicate cotent, which google gives a penatly to. Usually not an issue, but this prevents it happening at all.
-----
Nick

Tags: seo www url

Rate this page
Posted by NickR on Oct. 19 2007, commented by NickR on Oct. 20 2007, (popular)