.htaccess can';HTACCESS对PHP文件的IP限制

.htaccess can';HTACCESS对PHP文件的IP限制,.htaccess,ip-restrictions,.htaccess,Ip Restrictions,我有一个目录,受htaccess保护,以进行IP限制。 IP限制很好,但只适用于目录的.php文件除外 示例: site.com/dir/ <-- Get Access Denied Error site.com/dir/index.php <-- Open page without access denied error site.com/dir/您似乎想拒绝目录列表 对于特定文件,请尝试使用Option-index或IndexIgnore*.tgz

我有一个目录,受htaccess保护,以进行IP限制。
IP限制很好,但只适用于目录的
.php
文件除外

示例:

site.com/dir/             <-- Get Access Denied Error
site.com/dir/index.php    <-- Open page without access denied error

site.com/dir/您似乎想拒绝目录列表

对于特定文件,请尝试使用
Option-index
IndexIgnore*.tgz*.sql*.tar


有关更多信息,请参阅。

谢谢Rufinus,但我想限制一个目录(所有对象也包括php文件)仅从IP访问。您的限制块已经处理了这一点。(在这种情况下,验证行是无用的)
ErrorDocument 404 /notfound2.html
ErrorDocument 403 /notfound2.html
    AuthName "Access Restrict"
    AuthType Basic 
<Limit GET POST>
    order deny,allow
    deny from all
    allow from 47.147.50.5
</Limit>