Този сайт ще има ограничена функционалност, докато се извършва тече неговата поддръжка. Ако дадена статия не може реши проблема ви и искате да зададете въпрос, нашата общност е готова да ви помогне на @firefox в Twitter и /r/firefox в Reddit.

Търсене в помощните статии

Избягвайте измамите при поддръжката. Никога няма да ви помолим да се обадите или изпратите SMS на телефонен номер или да споделите лична информация. Моля, докладвайте подозрителна активност на "Докладване за злоупотреба".

Научете повече

Firefox keeps redirecting my localhost web page to another internet domain

  • 2 отговора
  • 1 има този проблем
  • 2 изгледи
  • Последен отговор от gregory.george.lewis

more options

I am a web developer who often writes websites on my own local computer. I use Apache web server, and using both the httpd.conf file and Windows' "hosts" file ( C:\Windows\System32\etc\hosts ) I can make an alias for 127.0.0.1, otherwise known as localhost. Because my name is greg, I can add a server name to my localhost, like http://greg/test.html.

This works pretty well, but sometimes when I add a new alias, like greg or gregory, Firefox doesn't pick up on it right away. I can go to http://greg/test.html in Chrome, and it goes to the local web page just fine. But if I try it in Firefox, it tries to redirect me to "http://www.greg.com". The usual fix is to go into Settings -> Privacy & Security -> Cookies and Site Data -> Clear Data -> Cached Web Content, then press CLEAR.

But this doesn't always work, and it seems like no matter what I clear, Firefox insists on not looking up my local server alias, but instead redirects me to https://www.greg.com.

How do I force Firefox to look for http://greg/ only on my local server?

I am a web developer who often writes websites on my own local computer. I use Apache web server, and using both the httpd.conf file and Windows' "hosts" file ( C:\Windows\System32\etc\hosts ) I can make an alias for 127.0.0.1, otherwise known as localhost. Because my name is greg, I can add a server name to my localhost, like http://greg/test.html. This works pretty well, but sometimes when I add a new alias, like greg or gregory, Firefox doesn't pick up on it right away. I can go to http://greg/test.html in Chrome, and it goes to the local web page just fine. But if I try it in Firefox, it tries to redirect me to "http://www.greg.com". The usual fix is to go into Settings -> Privacy & Security -> Cookies and Site Data -> Clear Data -> Cached Web Content, then press CLEAR. But this doesn't always work, and it seems like no matter what I clear, Firefox insists on not looking up my local server alias, but instead redirects me to https://www.greg.com. How do I force Firefox to look for http://greg/ only on my local server?

Всички отговори (2)

more options

Try to toggle this pref to true on the about:config page to see if that helps.

You can open the about:config page via the location/address bar. You can click the button to "Accept the Risk and Continue".

more options

As per cor-el's answer, I toggled the value to true, but it doesn't seem to change the behavior. Well, maybe there's something else going on that's outside the scope of Firefox.

In my hosts file, the line looks like this: 127.0.0.1 localhost, gregory.lewis, gregory, greg, ggl

They all work, except for greg (http://greg/test.html is the one that Firefox...and now I see Chrome, also, redirects to "https://www.greg.com"). It's not a hugely important problem at this point, since the server aliases more or less work. There's probably some logic related to the string "greg", which happens to be a sub-string of "gregory" and "gregory.lewis".