apache配置虚拟目录与默认文档

本文指导如何在Apache中创建虚拟目录aidd2008,并设置其物理路径和默认页面。包括在httpd.conf文件中添加配置,设置虚拟目录的权限,以及重启Apache以使更改生效。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

虚拟目录
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 为虚拟目录名称,一般不用在名称后加"/",若加入,每次都要在虚拟目录后输入"/"才能访问网站

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> 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

tgw2000

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值