-1

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
4

2 回答 2

1
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^subdir/? - [F]

RewriteCond 只是一个额外的保险。

必须激活 Apache 的 rewrite_module。

于 2013-04-28T20:38:23.697 回答
1
order deny,allow
deny from all
allow from 12.34.56.78

来源:这里

于 2013-04-28T21:00:07.140 回答