I am trying to test locally whether my virtual host is working. When i type the ServerName in the browser instead of requesting the web page from apache, chromium goes and searches the internet for websites corresponding to my virtual host. How do I make sure that what I type in the browser is requested from my apache and not from the internet?
1 Answers
For Google Chrome/Chromium, this is essentially a declined feature-request. What the browser does in this case is:
The designed way Chrome is intended to work in this case is that when a user inputs something that is a potential intranet hostname, Chrome does a background HTTP HEAD request to that hostname, and if it gets a valid reply, it displays an infobar atop the search result page, asking "Did you mean to go to
http://<hostname>/
?" If a user clicks that link, not only does it navigate to this hostname now, it also remembers that hostname in the future to avoid searching again. Similarly, doing any other successful typed navigation to that host (e.g. "hostname/" as suggested in (2)) will also cause Chrome to never search for that host again.
The only way to go to the page directly on the first attempt is to disable the search.
Or use workarounds:
- Type
http://foo
orfoo/
orfoo:80
, etc. - Switch to Firefox, which, according to the comments in that feature request, has the desired behaviour.
- Use a hostname with a
.
in it:foo.bar

- 197,895
- 55
- 485
- 740
http://localhost
instead of justlocalhost
. 2nd If you have some virtual hosts named in different way, for examplelocalhost2
,elio
etc. you must bound them with an IP address through/etc/hosts
. Please check this answer: http://askubuntu.com/a/811416/566421 – pa4080 Feb 01 '17 at 14:03