(1)DNS解析配置:
C:\Windows\System32\drivers\etc,打开hosts的配置文件,这里添加一条127.0.0.1 blog.com,即可在游览器输入blog.com打开本机的127.0.0.1界面
(2)修改apache默认的目录
E:\PHP\xampp\apache\conf,打开httpd.conf文件,将里面的路径修改为你存储网站的目录,在这里我的修改为
DocumentRoot "E:/PHP/xampp/workplace"
<Directory "E:/PHP/xampp/workplace">
(3)
E:\PHP\xampp\apache\conf\extra,打开httpd-vhosts.conf文件,末尾添加一段
<VirtualHost *:80>
DocumentRoot "E:/PHP/xampp/workplace/blog"
ServerName blog.com
<Directory />
AllowOverride All
Allow from all
Require all granted
</Directory>
</VirtualHost>
,这里还需将NameVirtualHost *:80前面的注释取消掉
(3)重启xampp
(4)在游览器输入blog.com即可访问