views:

1590

answers:

6

Hi there

I m using windows 7 prof. and i want to run my web project but url modife to www.localhost.com if use http://127.0.0.1:2710/default.aspx it working. i checked host file which in the C:\Windows\System32\Drivers\Etc\hosts. i deleted that rows :

#   127.0.0.1       localhost
#   ::1             localhost

but anything changes. how can i change www.localhost.com?

thx for help

+1  A: 

Did you try: http://localhost:2710/default.aspx ?

Rowland Shaw
+4  A: 

EDIT: The rows you deleted were just comments, so that doesn't matter.

Were you trying to enter your url just as localhost
or as http://localhost:2710/default.aspx?
The latter is probably necessary, as the 2710 is the port number, and without it will default to port 80, which probably doesn't have anything listening on it.


UPDATE: It might actually be an IPv6 thing, so try it with just this line in your hosts file:

127.0.0.1       localhost

You should not have a # at the beginning of the line, that will disable that line.

(You might need to reboot too).

You could also try pinging localhost (just type ping localhost in a command prompt window) and check that you get a reply from 127.0.0.1

Colin Pickard
+3  A: 

Hope I understand your question correct. You want to acces your local site using www.localhost.com

Just edit the hosts file and add the following lines

127.0.0.1 www.localhost.com

I checked my Windows 7 hosts file and it has the following lines

# localhost name resolution is handled within DNS itself.
#   127.0.0.1       localhost
#   ::1             localhost

Above lines are comments and deleting those lines does not do anything.

Note: If you get "Access denied" when you save the hosts file then open notepad as Administrator and then edit hosts file and save it. It should work

Shoban
No. i want to acces my local site using http://localhost:2710/default.aspx. but when i run my project i see www.localhost.com in url.my host file has # 127.0.0.1 localhost that row
cagin
Oh??? Can you post the complete content og hosts file? Are you in a network?
Shoban
alo.. does www.localhost.com work for you or yu are not able to see your site?
Shoban
A: 

i pushed run button and i m waiting http://localhost:2710/default.aspx but the url is http://www.localhost.com:2170/default.aspx. if i write http://127.0.01:2710/default.aspx everything is ok. but i want to change it with correct form.

cagin
The "correct" form ***is*** http://localhost:port/
Aviral Dasgupta
A: 

Okay, simply put, your web project will run on http://localhost:2710/default.aspx, once you put those lines you removed back into the hosts file (More on it here). To get to remove the port number, you need to reconfigure your web server.

Now, if you want to get a domain, that's a different thing altogether... then, you need to get a registrar and use DNS to get it to map to you. You would do this if you wanted other people to be able to use something like www.site.com to get to your site.

Aviral Dasgupta
I think his browser was auto-correcting the word `localhost` for him
Colin Pickard