0

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 ??

4 Answers4

0

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]
anthonysomerset
  • 3,983
  • 2
  • 20
  • 24
  • Shared hosting is windows. I am hosting a joomla site. I have added the lines which u suggested. It is not working :( – Gurucharan Balakuntla Maheshku May 23 '11 at 08: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 08: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 08:57
  • This is not really accurate. You are _allowed_ to make `www.whatever` into an alias for `whatever` if you are the owner of `whatever`, but there is no such mapping in place unless someone put it there, and some sites prefer to have them separate for various reasons. – tripleee Jun 03 '21 at 08:56
0

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

KCotreau
  • 3,361
  • 3
  • 19
  • 24
-1

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 ><

amazinghorse24
  • 35
  • 1
  • 1
  • 7
  • 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 :( – Gurucharan Balakuntla Maheshku May 23 '11 at 06:18
  • @GuruC - My mistake then, what settings/options are you allowed to change? – amazinghorse24 May 23 '11 at 06:26
  • 1
    http://serverfault.com/questions/31422/www-example-com-vs-example-com/31430#31430 Similar problem, but I don't know what options/abilities you have on the DNS Control Panel. – amazinghorse24 May 23 '11 at 06: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 07: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
-1

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.

booota
  • 99
  • 1