How to block all subdirectories with .htaccess ?
I have:
/
/subdir
/subdir/file_1
/subdir/file_2
and want to deny acces to
/subdir
yet to maintain full access to
/
/subdir/file_1
/subdir/file_2
How to block all subdirectories with .htaccess ?
I have:
/
/subdir
/subdir/file_1
/subdir/file_2
and want to deny acces to
/subdir
yet to maintain full access to
/
/subdir/file_1
/subdir/file_2
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^subdir/? - [F]
RewriteCond 只是一个额外的保险。
必须激活 Apache 的 rewrite_module。
order deny,allow
deny from all
allow from 12.34.56.78
来源:这里