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

I own several domains - mostly variations and misspellings on my "real" domain, and of course have the domains both with, and without, "www". I've been told it's a good idea to have them all end up in a single place. I know how to make them all show the same content, but I'm told that's not enough. What is, and how do I do it?

OK, this one's geeky, and is obviously aimed at webmasters who are managing their sites. But it's another question I actually get on a regular basis from folks who've visited my site.

Yes, it's easy to get "" and "" to show the same content, and essentially "be" the same site. But if you're looking to maximize your search engine placement, and present a single, unified site - that may not be enough.

Ask Leo! is a great example of what I mean. I actually own several domains that I want to refer to this site:

  • is the domain I've chosen to standardize on. This is "the" domain for Ask Leo!

  • same idea, different top-level domain (TLD), in case people mistype

  • same idea, different TLD, in case people mistype

  • is a domain I use when I'm speaking - I call it my "aural URL" because it's much easier to get right when you hear it.

And all of those work both with, and without, a "www." in front of them.

(You may ask why I don't have "" - it's owned by a domain squatter who, last time I checked, wanted too much money.)

If you click on any of those, though, you'll be taken to my "primary" domain, - when the page finally loads, that's the address you'll see in the address bar.

The same is true for "www." - I've chosen to standardize on not having the "www." in my URLs, so if you do go to, you'll still end up on my primary domain, "", without the "www".

So a quick test for your site: if you go to "", and just "", are the resulting URL's identical? (Replace "" with your domain, of course.) Have you picked whether you want to standardize on with, or without "www" and then used redirection to enforce it? If not, you're probably loosing some search engine ranking. Some search engines may see them as two separate sites - "" and "".

The typically accepted practice to make this happen is redirection. If a request comes in to your web server for one of your non-standard domains, the server redirects it, using what's called a 301 permanent redirect response code.

I do it using the URL Rewriting feature of the Apache web server.

Ideally in the server configuration file (httpd.conf, or a related file), or alternately in the ".htaccess" file, if your server configuration allows it, you can include the instructions to "rewrite" the URL that is about to be processed. We'll rewrite it to be a redirection to the desired URL.

Here are the rewriting instructions I use for

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

RewriteEngine on simply ensures that rewriting is enabled.

RewriteCond defines a condition that, only if met will cause the next statement to be executed. My condition is that the "HTTP_HOST", or the domain portion of the request does not (!) match exactly "". (NC indicates a case-insensitive comparison).

RewriteRule defines the rewrite to happen: the entire requested url after the host name, is replaced with my preferred domain, followed by that original URL.

In English, the bottom line is that the rule is simply this: "if we get a request for a URL that isn't on, make that same request on instead."

That's all there is to it. I know that if you're not familiar with the rewriting syntax it looks daunting, but it's conceptually very simple.

Note also that the way this rule is defined, any URL gets redirected, not just the site root. For example if you try to go to, you will end up at the correct page, but the URL will have been rewritten to remove the "www." because that's what I've standardized on.

Article C2639 - April 29, 2006 « »

Share this article with your friends:

Share this article on Facebook Tweet this article Email a link to this article
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?

1 Comment
manav jha
November 1, 2010 3:53 AM

i have one website i.e hosted on Network solutions,now i want to redirect all the 11 domains that i had registered from,to this site(

for tht,sd i need to host all the 11 domains????and how redirection will take place to the current site..plz send the feedback...

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.