当请求不是目录中的文件时,FallbackResource 响应 500 错误

FallbackResource responds with 500 error when request is anything but a file in the directory

在我的文档根目录中的 .htaccess 文件中,我使用 FallbackResource 指令来处理我的大部分 URL。它在 url 请求文档根目录中的文件时起作用,但是当它们请求子目录或子目录中的某些内容时,它会返回 500 错误。这是我的 .htaccess 文件:

# Use PHP5.4 as default
AddHandler application/x-httpd-php54 .php

RewriteEngine on


RewriteRule ^(Contact-Us|Driving-Directions|About-Us|Services|Sitemap)(?:\.html|\.php)?$ / [R=301,L]

RewriteRule ^vCards/([A-Z]+)\.vcf$ vCard?n= [L,NC]


FallbackResource index.php

每当我删除 FallbackResource 指令时,它都会 returns 一个 404。

服务器日志包含以下错误:

[Fri Jan 09 16:42:20 2015] [error] [client 108.48.69.131] Request exceeded the limit of 10 subrequest nesting levels due to probable confguration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
[Fri Jan 09 16:42:20 2015] [error] [client 108.48.69.131] No user or group set - set suPHP_UserGroup 
[Fri Jan 09 16:42:20 2015] [error] [client 108.48.69.131] unable to include "500.php" in parsed file /usr/local/apache/htdocs/500.shtml 

我没有设置日志级别的权限

示例:

  1. [HOST-HERE]/fakePage(正确处理)
  2. [HOST-HERE]/fakePage/(500 错误)
  3. [HOST-HERE]/fake/reallyFake(500 错误)
  4. [HOST-HERE]/fake/reallytotalfake/(500 错误)

我不确定你能用 FallbackResource 做到这一点。

但您可以使用:

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]