写我的life game时,注册登陆模块准备使用QQ和微博开放接口,总不能一直FTP吧,于是修改了host文件方便本地开发.记录下步骤...

  1. 打开host文件
C:\\Windows\\System32\\drivers\\etc\hosts

在最后添加一句

127.0.0.1 example.com//这里填你的域名,不需要http://
  1. 打开apache的配置文件httpd.conf,找到下面一行
# Virtual hosts
#Include conf/extra/httpd-vhosts.conf

将Virtual hosts下面这行开头的"#"号键给去掉

  1. 进入上面的那个conf文件,将该文件中所有的标签以及标签中的内容删除掉,添加以下几行
<VirtualHost *:80>
    DocumentRoot "xxxxx(你的www目录绝对路径)"
    ServerName localhost
</VirtualHost>
<VirtualHost *:80>
    DocumentRoot "xxxx(你的网站在本地的根目录的绝对路径)"
    ServerName example.com
</VirtualHost>
  1. 重启apache,访问"example.com",成功指向本地,ok,大功告成,开始开发了...