I am running my AWS Elastic Beanstalk Application
PHP 5.6 running on 64bit Amazon Linux/2.9.4
Every time i got this Warning in my apache log.
AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
I belive could be my .htaccess , this is my code:
ErrorDocument 404 /404.html
Options -Indexes
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$/?$ %{REQUEST_FILENAME}\.php [NC,L]
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 month"
</IfModule>
<IfModule mod_headers.c>
Header unset ETag
</IfModule>
FileETag None
<IfModule mod_headers.c>
Header unset Last-Modified
</IfModule>
Any ideia about this error?
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$/?$ %{REQUEST_FILENAME}\.php [NC,L]
Your rule to append the .php file extension is incorrect. You are effectively rewriting to a non-existent file... repeatedly. Try the following instead:
# Append .php file extension if omitted and destination file exists
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI}.php -f
RewriteRule !\.\w{2,4}$ %{REQUEST_URI}.php [L]
The above states... for any request that does not already have a file-extension, it tests to see if a file exists with the .php extension exists before internally rewriting to it.
There's no need to backslash escape literal dots in the RewriteRule substitution, since this is an "ordinary" string (not a regex).