Alias hostname for localhost

When the browser sees http://localwebapp/ it first tries to determine the IP address of localwebapp. If this succeeds, the browser establishes a TCP connection with that host, using a specific port (which is 80 for HTTP, unless some other port is mentioned in the URL).

Resolving localwebapp to an IP address does not take port information into account, so pointing http://localwebapp/ to http://localhost:1234/ can only be done by means of a HTTP redirection.


To make http://localwebapp:1234/ the same as http://localhost:1234/, edit the hosts file of your operating system by adding the line

127.0.0.1 localwebapp

The location of the hosts file depends on the operating system:

  • For UNIX-like operating systems, it’s usually /etc/hosts.
  • For Windows, it’s usually: C:\Windows\System32\drivers\etc\hosts

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)