【问题标题】:exclude folder in a filesMatch in htaccess在 htaccess 中的 filesMatch 中排除文件夹
【发布时间】:2016-03-22 15:40:57
【问题描述】:

我有一个 .htaccess:

<FilesMatch "\.php$|\.js$">
    SetHandler application/x-httpd-php
</FilesMatch>

如何排除子目录?

非常感谢。

【问题讨论】:

  • 您不能使用 filesMatch 排除文件夹,请使用 mod-rewrite

标签: apache .htaccess web


【解决方案1】:

试试这个:

RewriteEngine on


RewriteCond %{REQUEST_URI} !^/folder_to_exclude
RewriteRule \.(php|js)$ - [H=application/x-httpd-php]

【讨论】:

  • 谢谢,但不幸的是,这使我的网站进入“内部服务器错误”模式
  • 我使用了文件夹的绝对路径和相对路径
  • 好的,在我的子目录中还有另一个导致 505 错误的 htaccess。它现在正在工作。谢谢!
猜你喜欢
  • 2013-10-27
  • 2012-11-30
  • 2013-07-17
  • 2023-04-03
  • 2011-01-20
  • 1970-01-01
  • 1970-01-01
  • 2015-12-11
相关资源
最近更新 更多