如何避免来自 ISP 的 404 重定向?
我相信 stackexchange 的某些子域刚刚关闭。这次事件让我想起了一个我一直想问的问题。如前所述,“如何避免来自 ISP 的 404 重定向?”例如,我现在输入 Webapps 网址,但无法访问它;然而,我的 ISP(*cough,Comcast)并没有向我展示 stackexchange 中可能非常有用的 404 页面,而是将我重定向到他们的 搜索引擎。有没有办法在发送 404 重定向的同时规避这种行为?
我想我的问题中隐含着一个可能的误解——如果您不发送 404 重定向,而只是显示自定义的 stackexchange 404 搜索页面——这会破坏某些用户(例如移动用户)的兼容性吗? (我确信您可以根据用户来自的位置进行过滤并实时做出决定,但当涉及到网络服务器时,我是一个菜鸟 - 我的 404 只是一个静态页面 - 而且我真的很想知道是否有一个简单的解决方案可以防止我的用户遇到类似的头痛......
I believe some of the subdomains of stackexchange just went down. This event reminded me of a question I've been meaning to ask. As stated, "How can one avoid a 404 redirect from an ISP?" For example, I type in the Webapps url right now and I can't get to it; however, instead of showing me what is probably a very useful 404 page from stackexchange, my ISP (*cough, Comcast) redirects me to their search engine. Is there anyway to circumvent this behavior whilst still sending a 404 redirect?
I guess implicit in my question is a possible misunderstanding -- if you don't send a 404 redirect, but simply display the customized stackexchange 404 search page -- Would this break compatibility for some users, e.g. mobile users?? (I'm sure you could filter based on where a user is coming from and make the decision in real time, but I'm a noob when it comes to webservers -- my 404 is just a static page -- and I'm really asking if there's a simple fix to prevent my users from experiencing a similar headache...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,需要澄清的是,404 不是重定向,它只是一个错误代码。因此,当您询问“如果不发送 404 重定向”时,这并不是一个真正有效的问题。
听起来发生的情况是,您正在使用 ISP DNS 服务器,当您的浏览器向它们询问类似“donestexist.example.com 的 ip 地址是什么”(不存在的东西)之类的问题时。他们不会向您的 ISP 返回“未找到名称”的 DNS 响应,而是向您提供其搜索引擎的 IP 地址。这可能是为了打着提供帮助的幌子来增加他们网站的流量。
您也许可以通过切换名称服务器来摆脱这个问题。也许到谷歌的 8.8.8.8 名称服务器。
First, as a clarification, a 404 isn't a redirect, its just an error code. So when you ask about "if you don't send a 404 redirect", its not really a valid question.
It sounds like what is happening is that you are using your ISPs DNS servers, and when your browser asks them something like "what is the ip address of doesntexist.example.com" (something that doesn't exist). Instead of your isp returning a "name not found" DNS response, they give you give you the ip address of their search engine. This is probably in order to drive traffic to their website under the guise of being helpful.
You can probably get rid of this by switching nameservers. Perhaps to google's 8.8.8.8 nameserver.