Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

In any browser if I use www.mysite.com or just mysite.com the web page is correctly retrieved, but I am having trouble with Google Analytics and Facebook App.

Facebook: To be able to get Likes, I create the Facebook App needed and set the site URL to http://mysite.com/. Using their tool http://developers.facebook.com/tools/debug/ when I test my page using http://mypage.com it works but using http://www.mypage.com fails with the message:

Object at URL 'http://www.mysite.com/' of type 'website' is invalid because the domain 'www.mysite.com' is not allowed for the specified application id.

Google Analytics: To be able to get traffic statistics, I created a Property and a Profile both with the URL http://www.mypage.com and no statistics were gathered in a week, when I changed the configured URL to http://mypage.com statistics where available a few hours later.

What should I do to have statistics and likes for both www.mysite.com and mysite.com ??

share|improve this question
    
I found the detailed instructions for the needed redirection here How to Redirect from Your Root Domain to the WWW Subdomain and Vice Versa Using mod_rewrite –  sapeish Sep 18 '12 at 16:05

2 Answers 2

up vote 4 down vote accepted

You REALLY don't want to be using both the www subdomain AND the naked domain. This is terrible on the SEO. You can pick either, and it makes no difference which, but once you choose, you must stick with it.

The reason you get that Facebook error is because you originally configured it to use the named domain, and it treats the www subdomain as a separate entity. Same issue with Google.

After you make your decision, you'll want to redirect the one you're NOT using, to the one you picked. (You can do a 301 Permanent Redirect with an Apache rewrite rule, or if you're going from the naked domain to the www subdomain, look at http://wwwizer.com.

share|improve this answer
1  
Good answer, although your first paragraph is a little over-dramatic - www & non-www is not terrible for SEO, search engines understand perfectly fine when a site runs on both. –  DisgruntledGoat Aug 30 '12 at 1:39
    
@DisgruntledGoat - Thanks, I like being dramatic. It should be enforced that it's always better to have one or the other but not both or none (XOR). –  ionFish Aug 30 '12 at 1:41

Fundamentally, www and non-www are two seperate addresses which (in general) just happen to point to the same content - largely because most web-hosts alias www and non-www

But there is no reason for this to be the case, and these two options are certainly not the only ones (think Wikipedia with en.wikipedia.org de. (etc) and where the www site is a "select your country"

In a non-pejorative sense, this is mostly down to laziness and/or ignorance of the public and many hosts.

Now back to you question, if you have both set up to be the same content, then as far as the typical user is concerned, they are the same website - but many apps (and standard SSL certificates) are not so "clever", and know that they are two separate entities.

Using both will mean incoming links are split, thus splitting any page-rank; also some search-engine crawlers treat the two as separate but duplicate, therefore penalizing you further.

There are pitfalls for using both on a site, but only benefits for sticking with a single option.

This is why it is important to pick one, and use a 301 redirection for the others (and potentially wildcard subdomains too). My preference (YMMV) is to adopt the non-www as standard.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.