apache 下设置虚拟目录和默认页面

1.找到"conf/httpd.conf" 文件


2.在httpd.conf里面加了如下语句

Alias  /anstyla  "E:/anstyla/src/web"
<Directory "E:/anstyla/src/web"> 
          Options Indexes MultiViews 
          AllowOverride None 
          Order allow,deny 
          Allow from all 
</Directory>

在此模块下建立虚拟目录,Alias /虚拟目录名称/ "虚拟目录路径,以[/]代替[/]"

例如:Alias /admin "D:/web/admin/"

(*)/admin 为虚拟目录名称,一般不用在名称后加"/",若加入,每次都要在虚拟目录后输入"/"才能访问网站;D:/web/admin/ 为虚拟目录的物理路径.

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  /anstyla  "E:/anstyla/src/web"
<Directory "E:/anstyla/src/web"> 
          Options Indexes MultiViews 
          AllowOverride None 
          Order allow,deny 
          Allow from all 
          DirectoryIndex default.php
</Directory>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值