Helping people with computers... one answer at a time.

As the owner of a web site there are plenty of decisions to make. One of the first is whether to standardize on including "www" or not.

You refer to your site as "" without the "www" in front. But most other sites almost always include the "www". And "" works, but sends me to "".

I'm confused - when I talk about my own site do I use "www" or don't I? Why don't you? In fact, why and how do you force it not to even when people use "www"?

I've mentioned it before: when entering a URL into a browser in most cases the www is optional. Unless a site has something instead of "www", most sites work either way. As you note, both and work and send you to the same place.

But when you create links to and within your web site you want to choose one style and stick with it.

In fact, if you can you want to force the style you picked as much as possible.

I'll explain why that is, and why I picked what I did.

Why you want to choose one and stick with it

Here's the deal: very technically


are two different pages.

"It matters very much if you care about your position in search results."

They're as different as if they'd been on two completely different sites. The fact that they have the same content - and might actually be the same page - doesn't really mean much. Since the URLs are different they are again, very technically, two completely separate pages.

It doesn't matter to your visitors - they see what they see, and that's probably the same on both.

It matters very much if you care about your position in search results.

As you're probably aware incoming links to your page is one of many criteria that the various search engines use to determine how important or relevant your page is in relation to specific search terms. To grossly over simplify the more incoming links the more important your page must be. (This is one of the reason website comment spam exists - it's an attempt to place incoming links.)

That means you want the search engines to see all those links going to the same page - not some links to one (with "www") and some links to another (without). Some search engines might be smart enough to realize that they're the same page (it is extra work, since they actually could legitimately be different pages), but many are not.

The take-away: "www" or no "www" - pick one and stick with it. Make sure all references that you create to your own website pages follow your choice.

Why I chose no "www"

I'm a purist and the way "www." is used these days is redundant and unnecessary and silly and just takes up more space and more syllables in everything you say, print, write and type. So why use it at all?

Even acknowledging that people expect "www", are use to it, and CTRL+Enter in a browser address bar types it in for you, these points are completely moot as long as eventually lands you on without the www. That means that people can use it if they want, you'll just ensure that they end up on to the right place.

Particularly these days people know that just about anything ".com" means that's a website and they'll do the right thing (or their browser will for them).

Now, knowing now what I didn't know then, I might choose differently. The good news is that the reason for my possible change of heart don't apply to the vast majority of web sites. That's a fairly geeky topic covered in Why might you want to use "www" in your website references?.

Forcing one or the other

By forcing people to land on the URL that you want, rather than whatever they typed in, any links they then create by copy/pasting out of the address bar (a common way to get the URL of a page), or any bookmarks that they save will use the style you selected.

By "forcing" I mean this: if you go to "" the page you will eventually end up on, and the address that you'll see in your browsers address bar is, without the www.

Even though you said www.

How'd I do that?

This is going to depend heavily on your web host, what technologies they use, and which features of that technology they've enabled for your use. I can only describe what I do; if you use different technology you'll need to do some more research. The good news is that I'm fairly certain the ability is available for most.

Ask Leo! runs on an Apache web server under a Linux distribution. Under Apache there's a feature known as "URL rewriting" that allows you to define a set of conditions and if those conditions are met the URL is "rewritten" to be something else that the visitor is then sent to. These instructions can be placed in the server configuration files, or if enabled they can be placed in a file named ".htaccess" in the root folder of your site.

Here are the instructions I use:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^ask-leo\.com [NC]
RewriteRule ^/(.*)$1 [L,R=permanent]

Without getting too involved in the details, those three lines essentially say:

  • Turn on the rewrite "engine", or in other words, enable URL rewriting

  • If the incoming request is not for the domain "" ...

  • ... rewrite the request to be for the domain "".

If I'd wanted to force "" instead, those lines would be:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.ask-leo\.com [NC]
RewriteRule ^/(.*)$1 [L,R=permanent]

Same idea: if the page being requested isn't on then rewrite it to be on

Bottom Line

As the owner of a website make sure to pick which of "" or "" you want to use, and use it consistently throughout your site and in all external promotion or links to your site. This will allow search engines to see your site consistently as a single site, and not two sites on two different domains.

And if you can, use rewriting to "force" visitors to land on your choice, regardless of which they actually typed in.

Article C4718 - January 21, 2011 « »

Leo Leo A. Notenboom has been playing with computers since he was required to take a programming class in 1976. An 18 year career as a programmer at Microsoft soon followed. After "retiring" in 2001, Leo started Ask Leo! in 2003 as a place for answers to common computer and technical questions. More about Leo.

Not what you needed?

Will Bontrager
January 25, 2011 8:58 AM

Just a note.

To allow any subdomains other than www, the second line can be changed to

RewriteCond %{HTTP_HOST} ^www\.ask-leo\.com

Meaning, *if* the request *is* for

The URL will then be rewritten only for and not for


Well, I see what you're doing, but the semantics are ... different.
In one hand, yes, that's simply removing www with mod_rewrite for people that want to standardize on that.
To illustrate (Without actually using rewrite syntax) my approach is:
  • if not
  • rewrite to
or, even more simply
  • if it's not what I want
  • make it what I want
your approach if I read your comment correctly
  • if
  • rewrite to
In other words it looks for one very specific case and corrects it.
My approach cares not how you got here (you could configure your server to send, and many others to the exact same place and they'd all get rewritten to
Yours, as you point out, preserves subdomains.
Personally I've not seen many servers that route subdomains to the same place as base domains, but then the same argument could be made for sending several domains to the same spot I suppose.
(Will is the Will behind, a great resource for web site scripts and tools.)

Mark Eddy
January 26, 2011 4:40 PM

Though people might get a laugh out of this...

Most of our internal sites at work start with "www." We a re a very large global manufacturing business and these links are supposedly created by technically savvy people who work in IT. Go figure.

January 26, 2011 6:35 PM

Very good to know! I ran a website from 2001 to 2006, now I'm setting up again. I can't believe the changes in technology at the server!

Comments on this entry are closed.

If you have a question, start by using the search box up at the top of the page - there's a very good chance that your question has already been answered on Ask Leo!.

If you don't find your answer, head out to to ask your question.