当前位置:web 服务器 > Apache >>

apache指定目录禁止执行php文件

htaccess禁止php,htm

php_flag engine off

 代码如下 复制代码

<Files  ~ ".php">
order allow,deny
deny from all
</Files>

<Files  ~ ".htm">
order allow,deny
deny from all
</Files>

<Files  ~ ".html">
order allow,deny
deny from all
</Files>

<FilesMatch (.*).htm$>  
    order allow,deny    
    deny from all    
</FilesMatch>

<FilesMatch (.*).html$>  
    order allow,deny    
    deny from all    
</FilesMatch>

在apache中直接定义

 代码如下 复制代码

<Directory /usr/local/apache/htdocs/bbs/data>
php_flag engine off
</Directory>
<Directory ~ "^/home/centos/web/data">
 <Files ~ ".php">
 Order allow,deny
 Deny from all
 </Files>
</Directory>

nginx

 代码如下 复制代码

location /data/ {
location ~ .*.(php)?$ {
deny all;
}
}

补充:Php教程,apache 
Apache
IIS
Nginx
Tomcat
如果你遇到web 服务器难题:
请访问www.zzzyk.com 试试
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,