Forum Moderators: phranque

Message Too Old, No Replies

www.domain.com / domain.com problem

         

blakekr

2:31 am on Feb 14, 2005 (gmt 0)

10+ Year Member



Google has pageranked my site separately for

www.mydomain.com and

mydomain.com

I stopped getting google traffic this weekend and I'm afraid I'm dealing with a duplicate content penalty.

What's the correct way to handle mydomain.com to make google happier? I tried a 301 redirect in .htaccess but ended up creating an infinite loop.

trillianjedi

5:38 pm on Feb 15, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



OK, quick one about PR, but this isn't the Google forum, so if you need further help on this one, you'll need to repost over there:-

Google has pageranked my site

Google doesn't give PageRank for sites, only for pages - hence the difference here:-

Google has pageranked my site separately for
www.mydomain.com and mydomain.com

That is perfectly correct, as they are two separate/distinct pages.

OK, enough Google. See here : [webmasterworld.com...] for more on PR.

The 301 is the correct thing to do. The infinite loop is probably because you are forwarding all pages from example.com to www.example.com. And www is actually just a subdomain of example.com, so the redirect will always be redirecting (assuming both sites to be hosted on the same server/IP address).

I suspect you've done something like:-

redirect permanent / www .example.com

What you need is:-

RewriteEngine on 
RewriteCond %{HTTP_HOST}!^www\.domain\.com [NC]
RewriteRule ^(.*) http://www.domain.com/$1 [L,R=301]

TJ

foxtunes

11:42 pm on Feb 16, 2005 (gmt 0)

10+ Year Member



Does this do the same thing?

RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain.com
RewriteRule (.*) [domain.com...] [R=301,L]

I wanted the [www...] version to appear in the browser not the http://