配置 Apache 虚拟目录
虚拟目录
首先定位到 "conf/httpd.conf" 配置文件。
在该配置文件的相应节点位置:
在 <ifmodule alias_module> 标签内增加Alias /aidd2008 "D:/php/web/aidd2008"
此处 aidd2008 是你希望访问的虚拟目录别名;D:/php/web/aidd2008 则是实际的物理存储路径。注意路径中的反斜杠应替换为正斜杠 [/]。
我们就在
继续添加以下内容:
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
其中 aidd2008 代表虚拟目录的名称。通常建议在名称后不要添加斜杠 "/",否则每次访问时都必须在 URL 的虚拟目录后手动输入 "/" 才能正常进入网站。
Alias /gt "D:/PHP/gt"
php_admin_flag safe_mode off
AllowOverride AuthConfig
Order allow,deny
Allow from all
完成配置后,需要重启 Apache 服务使更改生效。
设置默认页面
方法一:进行全局设置。
DirectoryIndex index.php index.php4 index.php3 index.cgi index.pl index.html index.htm index.shtml index.phtml default.php
方法二:针对特定目录进行单独设置。
Alias /aidd2008 "D:/php/web/aidd2008"
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
DirectoryIndex default.php