设置主机文件-伪造URL [英] Setting up a Host File - Faking URLs
问题描述
我正在尝试设置开发实例,以便我可以伪造自己拥有的一些URL.我的网站上有许多url,根据您访问我的网站的URL的不同,域名也会有所不同.
I'm trying to set up my development instances so that I can fake some urls that I own. My website has a number of url's and depending on the one you visit my site will act differently based on the domain..
ive编辑了我的C:\ WINDOWS \ system32 \ drivers \ etc \ hosts文件,使其包含以下内容
ive edited my C:\WINDOWS\system32\drivers\etc\hosts File to contain something like below
127.0.0.1 localhost
127.0.0.1 SomeDomain.com
127.0.0.1 MyDomain.com
现在,如果我访问本地主机,一切正常,但是当我尝试访问SomeDomain.com或MyDomain.com时,它会根据浏览器生成几条不同的消息
Now if I visit localhost everything works fine but when i try visit SomeDomain.com or MyDomain.com it produces couple different messages depending on browsers
Firefox-错误请求(无效的主机名)" Chrome-要求提供用户名/密码,然后点击(不输入任何内容)与firefox相同的产品
Firefox - "Bad Request (Invalid Hostname)" Chrome - Asked for a username/password and just hitting on (not entering anything) products same result as firefox
IE6-无法显示该页面"
IE6- "The page cannot be displayed"
有什么想法吗?
推荐答案
您的HOSTS文件看起来不错.另外,请尝试添加每个版本的www版本,例如: 127.0.0.1本地主机 127.0.0.1 SomeDomain.com 127.0.0.1 www.SomeDomain.com 等等
Your HOSTS file looks good. Also try adding the www version of each one, e.g.: 127.0.0.1 localhost 127.0.0.1 SomeDomain.com 127.0.0.1 www.SomeDomain.com etc
但是,问题可能出在Web服务器的设置上.如果您使用的是IIS,则问题可能出在您没有正确设置主机头.
However, the problem is probably the setup of the web server. If you're using IIS, the problem probably is that you haven't set up host headers correctly.
这篇关于设置主机文件-伪造URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!