Since upgrading from Firefox 3.6.x, my address bar has a quirk that never used to be there. When I type in, for example:

localhost/my_dir/index.php

Firefox turns it into a search query, my search engine is Google. To work around this (after forgetting I need to do this almost every time for FF), I must type in:

http://localhost/my_dir/index.php

This way, I am directed correctly to my localhost server. I don't need to do this for any other browser, and I thought this Q/A on URL trimming might change the behaviour, but it didn't.

Any ideas on how I can prevent 'localhost' from being turned into a search query?

link|improve this question

feedback

2 Answers

up vote 2 down vote accepted
  1. Type about:config in the URL bar
  2. In the filter search box, type browser.fixup.alternate.suffix
  3. Double click this entry to edit it and remove: .com

Now your localhost files should work without having to add http://.

link|improve this answer
Simple and accurate, thanks tao – Danjah Jan 27 at 23:32
This doesnt work for me! I've restarted Firefox and entering "localhost:4567" does a google search! – IanVaughan Feb 21 at 11:35
feedback

I know this is kind of a weird solution, but you could map localhost.com to 127.0.0.1 with your %windir%\system32\drivers\etc\hosts file.

Start notepad as administrator (by using the context menu on-top of it in the Start menu) and open the file %windir%\system32\drivers\etc\hosts, then add an entry like this:

127.0.0.1 localhost.com

to the end of the file. Save. Now you should be able to use localhost.com in place of localhost, which Firefox shouldn't complain about. Note that this works for practically any domain name you want, so you can make it shorter.

link|improve this answer
I've been using this method since I discovered it a couple of weeks ago. I use local.host. This is a much simpler solution than configuring the search engines in the browser. :) – iglvzx Jan 27 at 3:00
Hmm... my hosts file already has "127.0.0.1 localhost" in it, I added the new entry, saved as admin - checked, restarted Firefox... same behaviour. @iglvzx: Do you literally type in "local.host/xyz" to the address bar after adding that to hosts? – Danjah Jan 27 at 3:28
@Danjah Yes, that's what I do. What did you add to your host file? – iglvzx Jan 27 at 3:33
I added another line, under "127.0.0.1 localhost", "127.0.0.1 localhost.com", is that correct? – Danjah Jan 27 at 4:49
1  
This will work in all of your browsers, and additionally you can make it shorter (e.g. l.h should work even.) – John Chadwick Jan 27 at 5:24
show 2 more comments
feedback

Your Answer

 
or
required, but never shown

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