分享

Apache 虚拟目录、默认首页的设置

 xf_baby 2014-01-06

Apache虚拟目录和默认首页的设置,用apache服务器的朋友必须要懂的。

虚拟目录 
1.找到"conf/httpd.conf" 文件 
2.在节点:<IfModule alias_module>里增加 
Alias /aidd2008 "D:/php/web/aidd2008" 
其中 aidd2008 是你想要访问的虚拟目录; D:/php/web/aidd2008 为物理路径,以[/]代替[\]" 
我们就在</IfModule>后面接着加: 
复制代码 代码如下:

<Directory "D:/php/web/aidd2008"> 
Options Indexes MultiViews 
AllowOverride None 
Order allow,deny 
Allow from all 
</Directory>

(*)aidd2008 为虚拟目录名称,一般不用在名称后加"/",若加入,每次都要在虚拟目录后输入"/"才能访问网站 www.。

Alias /gt "D:/PHP/gt" 

<Directory "D:/PHP/gt"> 
  <IfModule php5_module> 
    <Files "index.php"> 
      php_admin_flag safe_mode off 
    </Files> 
  </IfModule> 
  AllowOverride AuthConfig 
  Order allow,deny 
  Allow from all 
</Directory>


3.重启Apache

设置默认页面 
方法1 设置全局的: 
<IfModule dir_module> 

DirectoryIndex index.php index.php4 index.php3 index.cgi index.pl index.html index.htm index.shtml index.phtml default.php 
</IfModule>

方法2 针对某一目录可以这么设置: 
Alias /aidd2008 "D:/php/web/aidd2008" 

<Directory "D:/php/web/aidd2008"> 
Options Indexes MultiViews 
AllowOverride None 
Order allow,deny 
Allow from all 
DirectoryIndex default.php 
</Directory>

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多