Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I recently purchased a hosting plan from one of the service providers. They offered a free domain-name to me and I gladly purchased it.

Now I logged into their control panel and put all my files there and then my site became online and is working fine.

I observed yesterday that when I hit or, the site displays correctly. But I had thought that when I hit, it will get redirected to which is not happening. Also I read in internet wherein some people say the two are different.

I am really confused regarding this. Are and different? If yes, how do I set up a redirect such that all requests redirect to

I also want to know where do I setup the redirection ??

share|improve this question

migrated from May 25 '11 at 13:41

This question came from our site for professional and enthusiast programmers.

up vote 2 down vote accepted

The www subdomain is the historical subdomain for the webserver (in contrast to for example). But today its rather confusing. The initiative is even suggesting to drop it.

So they suggest to redirect the other way around, from to If you have an Apache webserver, you can do it like this:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L] 

This can be done in the Apache configuration file or in a local .htaccess file, whatever is possible in your provider's environment.

share|improve this answer

Basically they are two different things. DNS (the service which translate human readable addresses like "" into IP address like "") sees and as two different things. When a request for the particular address is sent to a DNS server, it will provide the IP address that it refers to. Since in this case its the same server, it gets handled by the .htaccess as shown above. Otherwise you would have to create DNS name pointers (called A-Records) which associate the given URL to a particular IP address.

share|improve this answer

Your Answer


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.