.htaccessip-restrictions

can't IP restriction on PHP files with HTACCESS


I have a directory and Protected with htaccess for IP Restriction.
IP restriction work good but just for Directory's Except .php files.

example :

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

My .htaccess files:

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>

I want to restrict a directory (with all objects includes php files too) to access from just a IP
Where's the problem ?


Solution

  • It seems you want to deny Directory Listing.

    Try Option -Indexes or IndexIgnore *.tgz *.sql *.tar for specific files.

    see http://wiki.apache.org/httpd/DirectoryListings for more info.