作者:Amy爱爸爸爱妈妈 | 来源:互联网 | 2014-05-12 20:28
有时候在本地调试程序的时候总会出现一些目录一样的干拢,总会出现如下的地址http://127.0.0.1/test/,如果能把前面的127.0.0.1去了直接打入httpp://test/那岂快哉:1、修改host文件用记事本打开C:\WINDOWS\system32\drivers\etc\hos"/>
有时候在本地调试程序的时候总会出现一些目录一样的干拢,总会出现如下的地址http://127.0.0.1/test/,如果能把前面的127.0.0.1去了直接打入httpp://test/那岂快哉:
1、修改host文件
用记事本打开C:WINDOWSsystem32driversetchosts文件,你会看到如下的内容:
# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
127.0.0.1 localhost
在此内容后台加上127.0.0.1 test
现在http://test/所看的内容就与http://127.0.0.1所看到的内容就是一样的了
2、修改apache配置文件
打开httpd.conf文件
把#NameVirtualHost *:80前面的#去了
再在最后加上
# ServerAdmin webmaster@dummy-host.example.com
DocumentRoot E:/phproot/test
ServerName test
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
配置完毕,重启一下apache就OK了