bharat
bharat

Reputation: 330

how localhost domain name and actual domain differes

im newbie in web development. i have registered a domain name say mydomain.com. while developing my site i have changed my localhost domain name to mydomain.com. the thing is while im giving http://mydomain.com it is going to my localhost site..! when im typing http://www.mydomain.com its going to site which is in web server.

how these two things differ?? i searched about this but i found difference between www.domain.com & domain.com. but i want to know how www.domain.com is pointing webserver & domain.com is pointing to localhost??

thanks in advance!

Upvotes: 1

Views: 769

Answers (1)

VoltagE-ThE
VoltagE-ThE

Reputation: 91

All name resolving is always done the same way: First is local names (hostname) and local overrides (etc/hosts) Second the name is queried from an Domain Name Server. When you changed your domain you only said that your computer is mydomain.com. If you want it to be also ww.mydomain.com you have to tell it excplicitly (for example ad it to the list in etc/hosts)

Example etc/hosts file: 127.0.0.1 mydomain.com www.mydomain.com sqlserverl.mydomain.com localhost

After this all requests to the above domain names will be coming to your local server services.

The location of your etc/hosts file depends on your development machines OS, but in all *NIX based machines it's /etc/hosts. In Windows it's in C:\Windows\System32\drivers\etc\hosts.

Upvotes: 0

Related Questions