Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何创建拒绝访问主文件夹但允许访问子文件夹的 htaccess 文件?
例如: http : //www.mysite.net/folder1(拒绝访问)http://www.mysite.net/folder1/folder2(允许访问)
如果您有权访问 mod_rewrite 那么您可以在配置中添加一些条件 -
您可以使用捕获请求并将它们重写到不同的位置
RewriteCond {REQUESTED_FILE} !^/?(.*)/+$ RewriteRule .....
或者只是阻止他们
RewriteRule !^/?(.*)/+$ - [F]