我的目录中有近30个php文件,4个子目录。我想阻止用户直接查看一些 php 文件和子目录,例如http://bhavani.com/hai.php
我现在的htaccess
file
## Enable Mod Rewrite, this is only required once in each .htaccess file
RewriteEngine On
RewriteBase /
## Test for access to includes directory
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /includes/ .*$ [NC]
## Test that file requested has php extension
RewriteCond %{REQUEST_FILENAME} ^.+\.php$
## Forbid Access
RewriteRule .* - [F,NS,L]
怎么做?
您可以像这样过滤文件
<Files ~ "\.php$">
Deny from all
</Files>
和这样的目录
<Directory "/subdirectory">
Deny from all
</Directory>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)