Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Possible Duplicate:
www.example.com vs example.com

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 www.domain-name.com or domain-name.com, the site displays correctly. But I had thought that when I hit domain-name.com, it will get redirected to www.domain-name.com which is not happening. Also I read in internet wherein some people say the two are different.

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

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

share|improve this question

marked as duplicate by Mark Henderson Jul 25 '12 at 2:02

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

4 Answers 4

They are the same site, its mainly a relic of older systems when people had websites at www.domain.com and not at domain.com. It wont cause you any technical problems nowadays, however Google and other Search Engines will see the 2 as totally separate sites, despite them being one. This is generally bad as Google tends to rank this lower because of duplicate content issues.

If your shared hosting is Linux and Apache then the redirect is pretty simple, drop the following into a file called .htaccess (you may have to make your ftp client show hidden files to see it)

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^yourdomain.com [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [L,R=301]
share|improve this answer
    
Shared hosting is windows. I am hosting a joomla site. I have added the lines which u suggested. It is not working :( –  GuruC May 23 '11 at 8:33
    
A joomla site is probably hosted on an an apache server. Replace .htaccess content with i will break you and see if your website is still functioning. WARNING: don't do this on a live site, it is designed to kill the website. If your website breaks, then you're using apache, if it does not, well, you need to find out how your site is hosted. –  gAMBOOKa May 23 '11 at 8:47
    
sometimes the server will send headers which identifies itself, firefox or chrome can display these headers for you. is joomla also not able to forcably redirect to one of the 2 urls? –  anthonysomerset May 23 '11 at 8:57

You can do redirection, or simply set your DNS entries to point both the @ and the www to the same place.

share|improve this answer

I am still getting my IT degree, but as far as I know the difference between the two is minimal and it should get redirected. It used to be a bigger problem and all but not so much anymore.

I have never worked with a purchased domain name/system.

If you had access to the server itself, you can change the DNS zone files on the machine. Which is done differently for Windows/Linux Distributions.

You might just want to look through the options that the service provider gives you.

Sorry if I am mistaken, I am still learning ><

share|improve this answer
    
The problem is it is a shared hosting. I dont have access to everything on server . And by the way the difference between the two is not minimal because search engines index them differently :( –  GuruC May 23 '11 at 6:18
    
@GuruC - My mistake then, what settings/options are you allowed to change? –  amazinghorse24 May 23 '11 at 6:26
1  
serverfault.com/questions/31422/www-example-com-vs-example-com/… Similar problem, but I don't know what options/abilities you have on the DNS Control Panel. –  amazinghorse24 May 23 '11 at 6:31
1  
DNS only changes where a record points, which he doesnt want to do, it doesnt handle a redirect –  anthonysomerset May 23 '11 at 7:05
    
For my setup I have an A record for domain.com and a CNAME for www pointing to domain.com. www.domain.com and domain.com go to the same webpages and no redirect necessary in Apache. If OP doesn't care about google ranks, I think the 301 redirect is unnecessary. –  mazianni May 23 '11 at 16:12

Well as far as i know about them, they are different and most of the hosting providers do provide both the domains for you but there are some providers with the lack of this kind of service. Basically this is done by the service providers. You may try to ask them for this feature. They may charge you some extra amount. The thing they will do is redirect both domains to your account.

Hopefully, you will find a solution after contacting to your service provider.

share|improve this answer

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