简体   繁体   中英

How can I make it so my browser never tries to reintpret localhost as www.localhost.com?

I'm working with Firefox, but I'm sure answers for all browsers could be useful. When my browser can't find localhost:8000, it tries www.localhost.com:8000. I don't want it to ever do that because then I have to retype localhost.

Type about:config in the browser bar.

Type browser.fixup.alternate.enabled in the search box that appears.

Right click on the browser.fixup.alternate.enabled that appears in the filtered list below and choose Toggle to set the value to false .

Answering my own quesiton, I found a solution to the problem. You can simply set your hosts file to redirect www.localhost.com to 127.0.0.1. On Mac the hosts file is /etc/hosts. There is a similar file for Windows, and probably Unix/Linux as well. You can add this line to the file:

127.0.0.1 www.localhost.com

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM