How to prevent Firefox converting 'localhost/*' URLs into search queries?
- Type
about:config
in the URL bar - In the filter search box, type
browser.fixup.alternate.suffix
- Double click this entry to edit it and remove:
.com
Now your localhost files should work without having to add http://
.
In the Location bar, type about:config and press Enter.
The about:config "This might void your warranty!" warning page may appear. Click I'll be careful, I promise!, to continue to the about:config page.
In the Search field, type keyword.enabled.Double-click the keyword.enabled preference to set its value to false.
Please note that this will also prevent things that aren't URL-like from being used as search terms. For example, after making this change, if you type "how to tell if an egg is boiled" in the search bar, you'll just get a DNS error.
Other answers on this page give a way to attempt your suffix-less server name without modification (let's say you have a server in your domain called git
, when you type just git/
and there is a DNS problem, instead of navigating to www.git.com
you'll just get a DNS error page).
solution from Mozilla
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.