To disable all access to sub dirs (secure), use:
<Directory full-path-to/USERS> Order Deny,Allow Deny from All </Directory>
If you want to block only PHP files directly, follow these steps:
1 - Make sure you know which file extensions the server recognizes as PHP (and does not allow people to override htaccess). On one of my servers the value is set:
2 - Based on extensions, add regex to FilesMatch (or LocationMatch)
<Directory full-path-to/USERS> <FilesMatch "(?i)\.(php|php3?|phtml)$"> Order Deny,Allow Deny from All </FilesMatch> </Directory>
Or use Location to match php files (I prefer the approach described above)
<LocationMatch "/USERS/.*(?i)\.(php3?|phtml)$"> Order Deny,Allow Deny from All </LocationMatch>
Lance Rushing Aug 13 '09 at 13:30 2009-08-13 13:30
source share