I have a problem that only takes place in Google Chrome and it is OK in Firefox and IE. I have googled a lot of websites and done a few tips but nothing worked.
I have WAMP Server installed. I have setup two virtual hosts:
The problem is that whenever I enter localhost in the addressbar, It immediately redirects to enginter.local ! And Chrome shows this error for all of local URLs:
This page isn’t working
enginter.local didn’t send any data.
ERR_EMPTY_RESPONSE
httpd-vhosts.conf
:
<VirtualHost *:80>
ServerAdmin admin@example.com
DocumentRoot "d:/wamp/www/real/yegane"
ServerName yegane.local
ServerAlias www.yegane.local
ErrorLog "logs/yegane.local-error.log"
CustomLog "logs/yegane.local-access.log" common
<Directory "/">
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin admin@example.com
DocumentRoot "d:/wamp/www/real/enginter"
ServerName enginter.local
ServerAlias www.enginter.local
ErrorLog "logs/enginter.local-error.log"
CustomLog "logs/enginter.local-access.log" common
<Directory "/">
Require all granted
</Directory>
</VirtualHost>
And this is my hosts
file (in Windows 10):
127.0.0.1 localhost
#::1 localhost
127.0.0.1 enginter.local
127.0.0.1 yegane.local
I tried clearing the DNS cache here chrome://net-internals/#dns And also tried resetting everything to default in chrome://flags but no luck!
Once I restarted the system and the problem was gone. but after a while it happened again. And also port 80 is used by Apache.
I'm sorry if it's confusing. I'm confused myself and it has taken my time for a whole week.
UPDATE
Now all of my browsers are doing this!
UPDATE 2
httpd -S
gives:
VirtualHost configuration:
127.0.0.1:* is a NameVirtualHost
default server enginter.local (D:/wamp/bin/apache/apache2.4.23/conf/extra/httpd-vhosts.conf:43)
port * namevhost enginter.local (D:/wamp/bin/apache/apache2.4.23/conf/extra/httpd-vhosts.conf:43)
alias www.enginter.local
port * namevhost yegane.local (D:/wamp/bin/apache/apache2.4.23/conf/extra/httpd-vhosts.conf:57)
alias www.yegane.local
*:80 localhost (D:/wamp/bin/apache/apache2.4.23/conf/extra/httpd-vhosts.conf:30)
ServerRoot: "D:/wamp/bin/apache/apache2.4.23"
Main DocumentRoot: "D:/wamp/www"
Main ErrorLog: "D:/wamp/logs/apache_error.log"
Mutex default: dir="D:/wamp/bin/apache/apache2.4.23/logs/" mechanism=default
PidFile: "D:/wamp/bin/apache/apache2.4.23/logs/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
Define: APACHE24=Apache2.4
Define: VERSION_APACHE=2.4.23
Define: INSTALL_DIR=D:/wamp
Define: APACHE_DIR=D:/wamp/bin/apache/apache2.4.23
ServerAlias
entries do not match thehosts
entries. One haswww
the other doesn't. – DavidPostill♦ Nov 26 '17 at 17:32ServerAlias
entries and added a new virtual host withServerName
oflocalhost
(pointing to www directory). Now What happens is this: Contents ofyegane,local
andenginter,local
are shown but the request forlocalhost
redirects (instantly) toenginter.local
– pooria Nov 27 '17 at 8:45ServerAlias
makes that change mandatory so I commented it. Now I did as you said and addedwww.*.local
(* for each virtual host) But nothing changed. Again,localhost
redirects toenginter.local
– pooria Nov 28 '17 at 6:41