Page 1 of 1

Rename localhost

PostPosted: 02. June 2016 09:22
by Johannes58
Does anyone know if it is possible to rename localhost to read "http://mynet/" for example instead of "http://localhost/"

Re: Rename localhost

PostPosted: 02. June 2016 18:47
by gsmith
You can, but why?
You can add mynet and have both.
See c:\windows\system32\drivers\etc\hosts (no file extension)
Code: Select all
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

127.0.0.1       localhost
::1             localhost
127.0.0.1       mynet


You have to open your text editor as Administrator to save any changes and it's effective right away.

Re: Rename localhost

PostPosted: 02. June 2016 21:13
by Johannes58
Although that works, I was looking for a way to change it within Apache...

Re: Rename localhost

PostPosted: 02. June 2016 22:11
by Altrea
you cannot. The domainname needs to get resolved and that is not the task of Apache.

Re: Rename localhost

PostPosted: 03. June 2016 00:23
by gsmith
Look for ServerName in Apache.

However, mynet has to exist and be resolvable which is what adding it to the hosts file is for.
Apache, unless you have specific virtualhost/s, will answer anything pointing to your IP without regard for what the ServerName is set to.