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

时间:2015-01-10 01:14:57

标签: php apache .htaccess mod-rewrite

在我的文档根目录中的.htaccess文件中,我使用FallbackResource指令来处理我的大部分网址。它在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)?$ $1/ [R=301,L]

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


FallbackResource index.php

当我删除FallbackResource指令时,它会返回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 

我无权设置LogLevel

示例:

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

1 个答案:

答案 0 :(得分:1)

我不确定您是否可以使用FallbackResource

但你可以:

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