1、打开D:\program\xampp\apache\conf\httpd.conf文件,去掉LoadModule rewrite_module modules/mod_rewrite.so前的#,去掉Include conf/extra/httpd-vhosts.conf前的#,若无#,则忽略此操作。
2、进入conf/extra/httpd-vhosts.conf文件,在文件末尾插入以下语句:
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin phpexcel@php.com
DocumentRoot "E:/php/program/excel"
ServerName www.phpexcel.com
</VirtualHost>
<VirtualHost *:80>
ServerAdmin phpexcel@php.com
DocumentRoot "E:/php/program/excel"
ServerName www.phpexcel.com
</VirtualHost>
加上下段,只能访问到Index文件,若要访问索引目录,不要加下段
<Directory "E:/php/program/excel">
Options FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
</Directory>
<Directory "E:/php/program/excel">
Options FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
</Directory>