简体   繁体   English

我该如何做,以使我的浏览器从不尝试将localhost重新解释为www.localhost.com?

[英]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. 我正在使用Firefox,但可以肯定所有浏览器的答案都可能有用。 When my browser can't find localhost:8000, it tries www.localhost.com:8000. 当我的浏览器找不到localhost:8000时,它将尝试www.localhost.com:8000。 I don't want it to ever do that because then I have to retype localhost. 我不希望它那样做,因为那样我必须重新输入localhost。

Type about:config in the browser bar. 在浏览器栏中键入about:config

Type browser.fixup.alternate.enabled in the search box that appears. 在出现的搜索框中,键入browser.fixup.alternate.enabled

Right click on the browser.fixup.alternate.enabled that appears in the filtered list below and choose Toggle to set the value to false . 右键单击显示在下面过滤列表中的browser.fixup.alternate.enabled ,然后选择Toggle将值设置为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. 您只需设置主机文件即可将www.localhost.com重定向到127.0.0.1。 On Mac the hosts file is /etc/hosts. 在Mac上,hosts文件是/ etc / hosts。 There is a similar file for Windows, and probably Unix/Linux as well. Windows有一个类似的文件,也可能是Unix / Linux。 You can add this line to the file: 您可以将以下行添加到文件中:

127.0.0.1 www.localhost.com 127.0.0.1 www.localhost.com

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在localhost:3000上演示网站,但使地址栏显示http://mysite.com? - How can I demo a website at localhost:3000 but make the address bar show http://mysite.com? 我如何更改本地主机的URL - how can i change the URL of my localhost 如何在IIS 8中编写重写规则,以便所有流量都从http://*.com指向https://www.*.com? - How do can I code a rewrite rule in IIS 8 so that all traffic points to https://www.*.com from http://*.com? 如何将www.mysymfonypage.com/public更改为www.mysymfonypage.com? - How can I change www.mysymfonypage.com/public to www.mysymfonypage.com? 如何确保我的网站始终以www.mysite.com而不是以mysite.com的身份打开-这弄乱了我的Google OpenID登录名? - How can I ensure my website always opens as www.mysite.com and not mysite.com - this messed up my Google OpenID logins? 如何使www.site.com/123或www.site.com/123/some-headline都将用户引导到同一地点,即www.site.com/123? - how do you make it so that www.site.com/123 or www.site.com/123/some-headline will both lead users to the same place which is www.site.com/123? 如何枚举指向我的Tomcat / SpringMVC实例的非本地主机,非127.0.0.1 IP地址/域? - How can I enumerate non-localhost, non-127.0.0.1 IP addresses/domains that point to my Tomcat/SpringMVC Instance? JPATH指定“ localhost / var / www” - JPATH specifies “localhost/var/www” localhost别名在哪里设置,以便可以调整URL? - where's the localhost alias set so that URLs can be adjusted? 从localhost或www开始的Yii url - Yii url from the start localhost or www
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM