Skip to content
WJunction - Webmaster Forum

Google indexes my website twice..why?

Status
Not open for further replies.
Hello guys,

for some reason google indexes my website twice. What i mean by that is that it indexes a domain.com version and a www.domain.com version! (Why!?)

In webmaster tools, i have added both versions (www.domain.com and domain.com) and i have set the preferred domain to be the one with the www. in front!

Whats going wrong? :S
 

15 comments

is your website wordpress based? check these in general section:
ZWqeC.jpg
 
just use one URL, with or without www. Google sees them as being two different addresses. It can effect your ranking. search on google your term "with or without www" you will find a lot of related articles.
.
 
just use one URL, with or without www. Google sees them as being two different addresses. It can effect your ranking. search on google your term "with or without www" you will find a lot of related articles.
.

somebody told me that

because both of them are returning a 200 ok.

you need to 301 redirect one to the other, pick a preferred version. OR at the very least, use rel=canonical meta tags.
 
add this line in .htaccess of your root folder, it will redirect all www to non-www
PHP:
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

or if you wants with www in URL
PHP:
RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$
RewriteRule ^(.*) http://www.%{HTTP_HOST}/$1 [R=301]
 
ok then i am not sure about cpanel, might some other cpanel user can help you, else you can always add code in your htaccess i provided above.
 
DERPALICIOUS.

but yeah www is a subdomain, just like xyz.yoursite.com or omfgthisisasubdomain.yoursite.com.
so google treats it as such, meaning 2 sites.
 
Status
Not open for further replies.

About the author

G
Active Member · Joined
459
Messages
8
Reactions
18
Points

Advertise on WJunction

Reach 1000's of webmasters, hosts & affiliates. Banner & sponsored-thread slots available.

Contact us
Back
Top Bottom