Apache配置虚拟目录

时间:2014-12-04 17:59:37   收藏:0   阅读:205
找到conf/httpd.conf配置文件

找到:
<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>

修改为:

 

<IfModule dir_module>
    #DirectoryIndex index.html
 
 #设置站点别名,别名与访问路径是相关的,取任何名称都可以(除特殊)  
 Alias /maojd "F:/hello"  
 <Directory "F:/hello">
 #设置访问权限
 Options +Indexes
 Order deny,allow
 IndexOptions Charset=UTF-8
 Allow from all
 </Directory>
</IfModule>


浏览器输入:http://localhost/maojd 即可访问F:/hello目录

bubuko.com,布布扣
解释说明:
#DirectoryIndex index.html
不注释掉的话,http://localhost/maojd默认去找 F:/hello下的index.html,有这个文件则访问index.html.没有这个文件则直接显示hello目录。
+Indexes+改成-号的话,可以访问html页面,不能访问目录。
 Alias /maojd "F:/hello"# 设置站点别名
Allow from all”改成 “Deny from all”,整个网站都不能被打开。 


评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!