apache的AllowOverride以及Options使用详解
allowoverride参数就是指明apache服务器是否去找.htacess文件作为配置文件,如果设置为none,那么服务器将忽略.htacess文件,如果设置为all,那么所有在.htaccess文件里有的指令都将被重写。对于allowoverride,还可以对它指定如下一些能被重写的指令类型.
通常利用apache的rewrite模块对 url 进行重写的时候, rewrite规则会写在 .htaccess 文件里。但要使 apache 能够正常的读取.htaccess 文件的内容,就必须对.htaccess 所在目录进行配置。从安全性考虑,根目录的allowoverride属性一般都配置成不允许任何override ,即
<directory />
allowoverride none
</directory>
在 allowoverride 设置为 none 时, .htaccess 文件将被完全忽略。当此指令设置为 all 时,所有具有 ".htaccess" 作用域的指令都允许出现在 .htaccess 文件中。
而对于 url rewrite 来说,至少需要把目录设置为
< directory /myblogroot/>
allowoverride fileinfo
< /directory>
2.在要支持url rewirte的目录启用 options followsymlinks和allowoverride all
alias /php "c:/web/php/"
<directory "c:/web/php/">
options indexes followsymlinks
allowoverride all
order allow,deny
allow from all
</directory>
这样通过http://localhost:8080/php/访问时,/php/和其下面的子目录将支持url rewrite
1 authconfig 允许使用所有的权限指令,他们包括authdbmgroupfile authdbmuserfile authgroupfile authname authtypeauthuserfile和require
2 fileinfo 允许使用文件控制类型的指令。它们包括addencoding addlanguage addtype defaulttype errordocument languagepriority
3 indexes 允许使用目录控制类型的指令。它们包括adddescription addicon addiconbyencoding addiconbytype defaulticon directoryindex fancyindexing headername indexignore indexoptions readmename
4 limit 允许使用权限控制指令。它们包括allow deny和order
5 options 允许使用控制目录特征的指令.他们包括options 和xbithack
options
1 all 准许以下除multiviews以外所有功能
2 multiviews 允许多重内容被浏览,如果你的目录下有一个叫做foo.txt的文件,那么你可以通过/foo来访问到它,这对于一个多语言内容的站点比较有用
3 indexes 若该目录下无index文件,则准许显示该目录下的文件以供选择
4 includesnoexec 准许ssi,但不可使用#exec和#include功能
5 includes 准许ssi
6 followsymlinks 在该目录中,服务器将跟踪符号链接。注意,即使服务器跟踪符号链接,它也不会改变用来匹配不同区域的路径名,如果在<local>;标记内设置,该选项会被忽略
7 symlinksifownermatch 在该目录中仅仅跟踪本站点内的链接
8 execcgi 在该目录下准许使用cgi
如对本文有疑问,
点击进行留言回复!!
相关文章:
-
-
-
-
-
-
-
-
-
-
yum 命令使用讲解
(一)yum介绍yum(全称为 yellow dogupdater, modified)是一个在fedora和redhat以及centos中的shell前端软件...
[阅读全文]
-
网友评论