apache的默认站点目录是htdocs,它的欢迎首页index.html即放在其中。
如果不想把项目放在该目录中,就需要设置虚拟路径。
假如我的项目叫ecshop,目录为E:\xy\ecshop,则
1.修改httpd.conf文件,在<IfModule dir_module>
DirectoryIndex index.html
</IfModule>后面,添加代码
<IfModule dir_module>
#directory相当于是欢迎页面
DirectoryIndex index.html index.htm index.php
#你的站点别名及其路径
Alias /ecshop "E:/xy/ecshop"
<Directory E:/xy/ecshop>
#访问权限设置
Order allow,deny
Allow from all
</Directory>
</IfModule>
2.还是修改httpd.conf文件,在DocumentRoot "E:/xy/Apache2.2/htdocs"前添加#,将其注释掉。