How to Access Localhost in Windows

How to access Localhost; By default the Windows TCP IP stack does not allow access to a local server using localhost. Many people find this out the hard way, after having installed XAMPP or another local server software on their Windows computer. After installation, they can access the local server via the local IP address 127.0.0.1, but not from localhost or http://localhost/.

In the following simple solution, I will show you how to resolve this problem and regain access to your XAMPP server using localhost once again.

Access Localhost to Edit Hosts File from Windows

  1. Navigate to C:\Windows\System32\drivers\etc
  2. Open the hosts file with a text editor, and remark the following line:
    ::1 localhost
  3. So it looks like this:
    #::1 localhostAccess localhost host file in Windows
  4. Save the hosts file.
  5. Restart your local server and try to access it via localhost.