mod_rewrite "Request exceeded the limit of 10 internal redirects due to probable configuration error."
Posted
by
Shoaibi
on Server Fault
See other posts from Server Fault
or by Shoaibi
Published on 2010-10-03T12:22:33Z
Indexed on
2012/04/08
5:32 UTC
Read the original article
Hit count: 474
What i want:
- Force www [works]
- Restrict access to .inc.php [works]
- Force redirection of abc.php to /abc/
- Removal of extension from url
- Add a trailing slash if needed
old .htaccess :
Options +FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
### Force www
RewriteCond %{HTTP_HOST} ^example\.net$
RewriteRule ^(.*)$ http://www\.example\.net/$1 [L,R=301]
### Restrict access
RewriteCond %{REQUEST_URI} ^/(.*)\.inc\.php$ [NC]
RewriteRule .* - [F,L]
#### Remove extension:
RewriteRule ^(.*)/$ /$1.php [L,R=301]
######### Trailing slash:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://www.example.net/$1/ [R=301,L]
</IfModule>
New .htaccess:
Options +FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
### Force www
RewriteCond %{HTTP_HOST} ^example\.net$
RewriteRule ^(.*)$ http://www\.example\.net/$1 [L,R=301]
### Restrict access
RewriteCond %{REQUEST_URI} ^/(.*)\.inc\.php$ [NC]
RewriteRule .* - [F,L]
#### Remove extension:
RewriteCond %{REQUEST_FILENAME} \.php$
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule (.*)\.php$ /$1/ [L,R=301]
#### Map pseudo-directory to PHP file
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule (.*) /$1.php [L]
######### Trailing slash:
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{REQUEST_FILENAME} !/$
RewriteRule (.*) $1/ [L,R=301]
</IfModule>
errorlog:
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., referer: http://www.example.net/
Rewrite.log: http://pastebin.com/x5PKeJHB
© Server Fault or respective owner