When I view http://localhost/ in Google Chrome, it tries to download the homepage as a file, and doesn't display it. I tried http://localhost/ in Firefox 4 and it works fine.

In Chrome though, loading displays my website [which is PHP btw]. is localhost in my /etc/hosts file.

How can I make Chrome load my local website thru http://localhost?

  • Have you tried http://localhost/? – RolandiXor Sep 13 '11 at 21:15
  • Try opening localhost in a different browser, does it work then? – Marco Ceppi Sep 13 '11 at 21:20
  • wow, weird. Ok, so first off localhost loads localhost/, and I just tried Firefox, and it works. But not in Chrome.. edited question. – Matt Sep 13 '11 at 22:42

This actually isn't anything wrong with the browser, per se. As I suspect, you created a php file - went to run it form the browser and it downloaded. So you went off, installed php5 and mod_php5 (and various other php packages) then tried again and it failed, again, but now works! This is simply a caching issue. Chrome remembers that the last time it accessed that php file it was downloaded - so it'll keep doing that until the browsers cache is dumped.

Clear Chrome's cache and you should be good to go!

  • 1
    @Matt It's okay I've done this a lot – Marco Ceppi Sep 14 '11 at 2:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.