本地网址用 http://localhost/ 或者 http://1270.0.1/ 可以访问,但开发每天都用上千次,还是觉得比较长,浪费时间浪费生命。
下面配置超短网址 http://i/ 为例子说明配置过程:
第一步:
1. 打开C:/WINDOWS/system32/drivers/etc
2. 使用记事本打开该文件(如下图). 在最后添加一行
这一行表示把 i 的IP指向定位在127.0.0.1
扫描二维码关注公众号,回复:
3783265 查看本文章
第二步:
找到apache安装目录下的conf/extra/httpd-vhosts.conf文件并打开,在文件最后增加以下配置:
<VirtualHost *:80>
##ServerAdmin [email protected]
DocumentRoot "C:/Users/weixinhong/htdocs/sd"
ServerName i
ServerAlias i
ErrorLog "logs/i-error.log"
CustomLog "logs/i-access.log" combined
</VirtualHost>
最后重启下apache,即可通过访问 i/ 访问到本地网站了