Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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 http://127.0.0.1 displays my website [which is PHP btw].

127.0.0.1 is localhost in my /etc/hosts file.

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

share|improve this question
    
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
add comment

1 Answer 1

up vote 4 down vote accepted

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 http://127.0.0.1 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!

share|improve this answer
    
lol ouch. Thanks, it worked! –  Matt Sep 14 '11 at 0:47
1  
@Matt It's okay I've done this a lot –  Marco Ceppi Sep 14 '11 at 2:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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