Last Updated: October 11, 2023
·
3.462K
· stffndtz

Prevent Chrome from searching when using Virtual Hosts

An issue i constantly run in to, so I'd like to share my knowledge with you.

So if you have configured you're Apache (in my case OSX 10.8) and try to set up local domains by adding entries to your

/private/etc/apache2/extra/httpd-vhosts.conf

or wherever you may have stored it, and by redirecting by changing the

/private/etc/hosts

file, you might have noticed that Chrome doesn't give a damn, and will search for you something like "myseriousbusiness.dev".

To prevent Chrome from going directly to the Google-Page, all you have to do is add two more entries to the hosts file.

For Example, if you have set up a Virtual Host named

coderwall.is.great.for.devs

go to your hosts file and instead of just using 127.0.0.1, paste the following

127.0.0.1 coderwall.is.great.for.devs
::1 coderwall.is.great.for.devs
fe80::1%lo0 coderwall.is.great.for.devs

Magic! Hope this helps at least a few. Happy Coding!

Oh and hey, if you ever lose localhost somewhere along the way, try that in your hosts

::1  localhost
fe80::1%lo0  localhost

:)

1 Response
Add your response

You can also just add http:// to your dev URL and the browser will bring you to the dev site. Then once it's done once you can just type mysite.dev after that

over 1 year ago ·