4

In any browser if I use www.example.com or just example.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://example.com/. Using their tool http://developers.facebook.com/tools/debug/ when I test my page using http://example.org it works but using http://www.example.org fails with the message:

Object at URL 'http://www.example.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.example.com and no statistics were gathered in a week, when I changed the configured URL to http://example.org statistics where available a few hours later.

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

1

2 Answers 2

5

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.

2
  • 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. Aug 30, 2012 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, 2012 at 1:41
3

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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