由于可能的配置错误,请求超过了 10 个内部重定向的限制

Request exceed the limit of 10 internal redirects due to probable configuration error

我的 htaccess 如下:

Options +FollowSymLinks
RewriteEngine On
RewriteBase /

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php
RewriteRule ^index\.php$ / [L,R=301]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index
RewriteRule ^index\.php$ / [L,R=301]

RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/ [L,R=301]

# remove .php from URL
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteCond %{REQUEST_URI} !/$
RewriteRule (.*) \.php [L] 

# restrict .php
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /[^\ ]+\.php($|\ )
RewriteRule \.php$ / [F,L]

# remove .html
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/.]+)\.html$ / [L,R=301] 

ErrorDocument 404 /error-page
ErrorDocument 403 /error-page 

RewriteRule ^good-([^-]*)-([^-]*)\.html$ /goodie?
sd=&sd= [L]
RewriteRule ^goodies-([^-]*)-([^-]*)$ /goodie_new?
sd=&ds= [L]
RewriteRule ^([^/.]+)/([^/.]+)/([^/.]+)/?$ /goodie_new?
ds=&sd=&de= [L]

RewriteRule ^blog/([^/.]+)/?$ /blogdetail_fm?prmn= [L]
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond  !cityres
RewriteRule ^([^/.]+)/?$ /cityres?cityf= [L]

当我访问 blog 重写 URL 即 http://example.com/blog/title-of-blog 然后我得到 500 Internal Server Error。我尝试添加 RewriteCond %{ENV:REDIRECT_STATUS} ^$ 但 500 错误仍然没有消失。

如果 myhtaccess 中有任何错误的规则,请告诉我错误。

这样说:

ErrorDocument 404 /error-page
ErrorDocument 403 /error-page 

Options +FollowSymLinks
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/ [L,R=301]

RewriteCond %{THE_REQUEST} /index\.php
RewriteRule ^index\.php$ / [L,R=301]

# skip files and directories
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

# restrict .php
RewriteCond %{THE_REQUEST} \.php($|\ )
RewriteRule \.php$ / [F,L]

# remove .html
RewriteRule ^([^/.]+)\.html$ / [L,R=301] 

RewriteRule ^goodies-([^-]*)-([^-]*)$ goodie_new?sd=&ds= [L,QSA]

RewriteRule ^good-([^-]*)-([^-]*)\.html$ goodie?sd=&sd= [L,QSA]

RewriteRule ^blog/([^/.]+)/?$ blogdetail_fm?prmn= [L]

RewriteRule ^([^/.]+)/([^/.]+)/([^/.]+)/?$ goodie_new?ds=&sd=&de= [L,QSA]

# remove .php from URL
RewriteCond %{DOCUMENT_ROOT}/\.php -f [NC]
RewriteRule ^(.+?)/?$ .php [L]

RewriteCond  !cityres
RewriteRule ^([^/.]+)/?$ cityres?cityf= [L,QSA]