Forum Moderators: Robert Charlton & goodroi
mmm - ask your ISP if they can fix this at the root server level which is better than using .htaccess, which is a file used by Apache to handle redirection.
Most people at WebmasterWorld seem to think it's best to choose ONE or the other (WWW or non WWW) and point all your links to that and redirect server to that single one. I've had great luck and PR for years with a site that does NOT do that but recently saw a traffic drop so I'm changing to "all WWW" format as a hopeful fix.
Based on the info I've seen and my own sites I think Google usually considers www and non www the "same page", but if there are many links to each they go ahead and assign different PR.
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain\.com
RewriteRule ^(.*)$ [domain.com...] [R=permanent,L]
I use them myself and it works good.
# Force www canonical hostname
RewriteCond %{HTTP_HOST} ^example\.com
rewriterule (.*) [example.com...] [R=301,L]
#
# Rewrite all requests to www subdirectory, but prevent rewrite looping
RewriteCond $1!^www/
rewriterule (.*) /www/$1 [L]
#
# Forbid direct-request access to /www subfolder
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /www/
rewriterule .* - [F]