New
#1
How to eliminate need for "localhost" prefix in Edge, localhosted site
Elsewhere in these forums it has been explained that for a localhost site to run in Edge, the Developer's Settings Use Microsoft Compatibility Lists and Allow Localhost Loopback should both be checked to be active. I have done that and I can use XAMPP for accessing the root of my localhost.
However, there is a specific problem that hasn't been addressed, and one that prevents relative paths in my site to be accessed on Edge.
First, please understand that my site runs in Edge when served from a live server. There's no problem there.
Second, please understand that I can in fact get to the index.php of the main folder of my sites on localhost, but with one caveat, and that is the source of all of the other problems:
--> In Edge, localhosted sites apparently (?) must be prefixed with 'localhost/' in order to be found and executed.
This means that if I have a site called "mysite1", I cannot simply put "mysite1/" in the URL bar of Edge to access it. Instead, I must prefix it with 'localhost/', like this: "localhost/mysite1/". Then and only then will Edge find the index.php in the mysite1 folder and proceed.
BUT: This means all relative path statements will not resolve correctly. For example, in my HTACCESS file, I have this MOD Rewrite directive:
Code:RewriteRule ^info/?$ /info.php [L]
This means that I can href info.php in the root of my site simply by using 'info'. However, because Edge insists on prefixing the URL with 'localhost/', a call to /info.php looks for it in the 'localhost/' directory, not the 'localhost/mysite1/' directory, and therefore it fails. This is also true for a simple HREF that calls '/index.php'. The only way around it is to put a dot before the slash, like this: './index.php'.
I need to learn what configuration should be used to eliminate the need for prefixing localhosted sites with 'localhost/'
All other browsers support my localhosted sites and serve them just by putting 'mysite1/', etc., in the URL bar. Edge seems to require a prefix of 'localhost/', thus 'localhost/mysite1'. I need to eliminate that requirement so that relative paths in my site code do not malfunction.
I am using the current version of XAMPP.
My C:\xampp\htdocs\ folder is shared with Administrator and with full permissions granted.
In C:\Windows\System32\drivers\etc\hosts I have:
etc.Code:127.0.0.1 localhost 127.0.0.1 mysite1 127.0.0.1 mysite2
And in C:\xampp\apache\conf\extra\http-vhosts.conf I have:
etc.Code:<VirtualHost *:80> DocumentRoot "C:/xampp/htdocs" ServerName localhost </VirtualHost> <VirtualHost *:80> DocumentRoot "C:/xampp/htdocs/mysite1" ServerName mysite1 </VirtualHost> <VirtualHost *:80> DocumentRoot "C:/xampp/htdocs/mysite2" ServerName mysite2 </VirtualHost>
This allows me to run either localhost, mysite1, or mysite2 by putting in a browser's URL bar respectively (except in Edge):
This is my system setup and configuration, in case that is relevant. What settings do I need to apply to Edge in Windows 10 to eliminate the requirement for a prefix of 'localhost/' before the name of each of my localhosted sites?Code:localhost/ mysite1/ mysite2/
Last edited by TomXampp; 19 Oct 2015 at 18:09.