If you had the SitePoint SEM Kit you’d already know about this, but since some folks haven’t actually bought it yet, here’s something important you should know.
Most web servers (therefore most web sites) are configured to show the same content whether visitors request a page with or without the www in the address. So h t t p : / /example.com is likely to give you the same content as h t t p : / / www.example.com.
If your website does this, that’s not good, because you are showing the same content to the search engines under more than one URL. In other words, your site is serving up duplicate content.
Now, some folks hear “duplicate content” and assume that there’s some kind of penalty involved, but that’s not really the problem. The problem is that search engines have to choose *one* of those copies, and declare it to be the official “canonical” URL. If you’ve put all of your effort into promoting www.example.com, you’d hope that the search engines would see that as the canonical version… but will they?
Maybe, but if God doesn’t play dice with the Universe, you definitely shouldn’t play dice with the search engines. Especially when a post at Threadwatch, the official blog of search engine spammers*, is talking about how to take advantage of your little mistake to sabotage your rankings.
The right solution is to pick one version (I like the www. version myself) and redirect the other version to it, with a 301 Permanent redirect. There are many ways to accomplish this, on most Apache setups it’s as simple as using your .htaccess file.
Example 1, .htacces entry to redirect anything.example.com (and example.com itself) to www.example.com:
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.example.com
RewriteRule ^(.*)$ http://www.example.com/$1 [R=permanent,L]
Example 2, to redirect anything.example.com (except for subdomain1.example.com and subdomain2.example.com) to www.example.com:
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www|subdomain1|subdomain2.example.com
RewriteRule ^(.*)$ http://www.example.com/$1 [R=permanent,L]
This code is provided for entertainment purposes only, use at your own risk, yadda yadda.
*Hi, Nick, just trying to boost your rankings for a targeted search term.
Frequently Asked Questions (FAQs) about www.example.com vs example.com
What is the difference between www.example.com and example.com?
The main difference between www.example.com and example.com lies in the technical aspect of how they are treated by servers. www.example.com is a subdomain of example.com. While they often lead to the same website, they are technically not the same. They can be set up to host different content. It’s important to ensure that both versions redirect to the same site to avoid confusion or potential SEO issues.
Why does www.example.com differ from example.com?
The difference between www.example.com and example.com is due to how DNS (Domain Name System) works. DNS is the system that translates human-friendly domain names into IP addresses that computers use. www is a subdomain, and it can be directed to a different IP address than the root domain (example.com).
Is there an SEO impact between using www.example.com and example.com?
Yes, there can be an SEO impact. Search engines treat www.example.com and example.com as two separate sites. This can lead to duplicate content issues if not properly managed. It’s recommended to choose one version (either www or non-www) and redirect the other to it using a 301 redirect.
How can I set up a redirect from www.example.com to example.com or vice versa?
You can set up a redirect by modifying your website’s .htaccess file or through your hosting provider’s control panel. The process may vary depending on your hosting provider and the platform your website is built on.
Can www.example.com and example.com have different content?
Technically, yes. www.example.com and example.com are treated as separate entities by the server and can host different content. However, this is not recommended as it can confuse visitors and search engines.
Which is better to use, www.example.com or example.com?
There’s no definitive answer as it largely depends on personal preference and your website’s needs. Some prefer www because it’s more recognizable as a website address, while others prefer the cleaner look of the non-www version.
Can I use both www.example.com and example.com for my website?
While you can technically use both, it’s not recommended for SEO reasons. Search engines may see this as duplicate content, which can negatively impact your site’s search rankings. It’s best to choose one and stick with it.
How do I choose between www.example.com and example.com?
The choice between www and non-www largely comes down to personal preference. Some prefer the traditional look of www, while others prefer the cleaner, modern look of non-www. Consider your audience and your brand when making this decision.
What happens if I don’t set up a redirect between www.example.com and example.com?
If you don’t set up a redirect, search engines may index both versions of your site separately. This can lead to duplicate content issues, which can negatively impact your site’s SEO.
Can users still access my site if I choose one version over the other?
Yes, users can still access your site regardless of whether you choose www or non-www. If you set up a redirect, users who type in the version you didn’t choose will be automatically redirected to the version you did choose.