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 线的问题,使子文件夹中的页面上的图像不显示。
RewriteRule \.(gif|jpg|png|mp3|mpg|avi|mov)$ - [F]
我会在子文件夹 .htaccess 中做什么来禁止此命令?
如果您的根目录中有一个 htaccess 文件,并且子目录也有一个 htaccess 文件,则子目录可以通过添加以下内容绕过父目录的 htaccess 文件中的所有规则:
RewriteEngine On
但是,如果您希望应用所有其他规则,则需要在根目录中的规则中添加条件以排除子目录:
RewriteCond %{REQUEST_URI} !^/subdirectory/ RewriteRule \.(gif|jpg|png|mp3|mpg|avi|mov)$ - [F]