Windows 10: How to eliminate need for "localhost" prefix in Edge, localhosted site

Page 2 of 2 FirstFirst 12
  1.    21 Oct 2015 #11

    I really mean the HOSTS file of Windows, not the Virtual Host configuation. My guess is that in Edge it will continue working without the entry from the HOSTS file, while it should then no longer work in all other browsers. If this is the case, then it means that Edge does not honor the HOSTS file at all. It then does not matter what you put in there; Edge will just ignore it.
      My ComputerSystem Spec

  2.    21 Oct 2015 #12

    Nope, that makes no difference. When I explicitly rem-out the localhost entry in the Windows HOSTS file, like this:

    Code:
    #127.0.0.1     localhost
    ...then my sites run on Edge with the 'localhost/' prefix, and they run without the 'localhost/' prefix on Chrome, Firefox, even IE11, and all the other browsers.

    In fact, I had put the "127.0.0.1 localhost" entry in the Windows HOSTS file without any need to, because at the top of the file, in the default commentary that Microsoft puts in the file explaining to the user how to use the file, there is found the following remarks by Microsoft:

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

    So, Microsoft there is explaining it's unnecessary to have a 'localhost' entry for 127.0.0.1 in its HOSTS file, as that's handled internally by the OS. And that's why my localhosted sites continue to run in the fashion I've described.

    Also, I tried to override the localhost definition by putting in a different one:

    Code:
    205.251.242.54		localhost
    ...but that doesn't work...the OS apparently ignores whatever definition you assign explicitly to localhost in the Windows HOSTS file and instead uses 127.0.0.1 exclusively, so there's never been a need for me even to have that definition in the Windows HOSTS file. (205.251.242.54 is the IP for Amazon.com, BTW...and I tried other IP addresses including nonsensical ones as well, so that pretty much proves it.)

    How about setting up the current version of XAMPP, configuring as I described above (with the correct definitions in the HTTPD-VHOSTS.CONF as I corrected it above, with 'htdocs/' in between 'localhost/' and 'mysite/', etc.), and see if you don't get the same results I'm getting.
      My ComputerSystem Spec

  3.    21 Oct 2015 #13

    TomXampp said: View Post
    In fact, I had put the "127.0.0.1 localhost" entry in the Windows HOSTS file without any need to, because at the top of the file, in the default commentary that Microsoft puts in the file explaining to the user how to use the file, there is found the following remarks by Microsoft:

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

    So, Microsoft there is explaining it's unnecessary to have a 'localhost' entry for 127.0.0.1 in its HOSTS file, as that's handled internally by the OS. And that's why my localhosted sites continue to run in the fashion I've described.
    Thanks for clearing that up. This means, localhost is a special case, which makes it a bad example...

    I have now tried configuring a few IPs in my HOSTS file, for example I set the IP of my router, gave it the name "router" and I now can open it using this name, also in Edge.
      My ComputerSystem Spec

  4.    21 Oct 2015 #14

    Okay, just to ensure I understand you, you mean that you can go to a locally hosted site just by putting the site name in the URL bar without prefixing it with 'localhost/', in other words, you can go to a site named 'router' by putting:

    Code:
    router/
    ...in your URL bar in Edge, not:

    Code:
    localhost/router/
    Is that correct? If so, could you please share with me (i.e. post here) the settings you put in your Windows HOSTS file as well as the configuration in the XAMPP HTTPD-VHOSTS.CONF file so I can try to duplicate your result in Edge and the other browsers?
      My ComputerSystem Spec

  5.    22 Oct 2015 #15

    Entering the IP of my router inside the HOSTS file just was the first step for me to see, if Edge would generally obey the HOSTS file. It does. I can access the router now by simply typing "router", without "locahost/" in front of it, inside the address bar. Note however, that this router is in my local network, but it is not localhost.

    I'll see, if I can get it running with XAMPP...
      My ComputerSystem Spec


 
Page 2 of 2 FirstFirst 12

Related Threads
I eagerly upgraded from Windows 8.1 Pro to Windows 10 Pro on July 29 the moment I got the upgrade link. But to my horror Edge is not working, WiFi drivers aren't working, nVidia Graphic drivers are corrupted. Somehow managed to install the other...
Is there a setting to turn this irritating popup off? In Internet Explorer there was an option to turn this off.
Read more: Google owned format support now reaches Microsoft Edge
I have upgraded 5 machines and clean installed 3 machines. Experienced an issue with one machine with continuous corruption problems After the 3rd attempt I discovered that even with a Clean Install of Win 10 I get unrepairable errors - Sorry...
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 03:58.
Find Us