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

.htaccess 由于可能的配置错误,请求超出了10个内部重定向的限制,.htaccess,mod-rewrite,url-rewriting,.htaccess,Mod Rewrite,Url Rewriting,我的访问权限如下: 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] RewriteCo

我的访问权限如下:

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/$1 [L,R=301]

# remove .php from URL
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteCond %{REQUEST_URI} !/$
RewriteRule (.*) $1\.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$ /$1 [L,R=301] 

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

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

RewriteRule ^blog/([^/.]+)/?$ /blogdetail_fm?prmn=$1 [L]
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !cityres
RewriteRule ^([^/.]+)/?$ /cityres?cityf=$1 [L]
当我访问
博客时
重写URL,即
http://example.com/blog/title-of-blog
然后我得到
500内部服务器错误
。我尝试添加
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}/$1 [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$ /$1 [L,R=301] 

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

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

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

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

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

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

这很有魅力,但现在我的css被打乱了,因为我的基本URL现在是
http:example.com/blog/style.css
。我在页面上尝试了
,但CSS仍然没有得到应用。我将URL生成为
$URL=$\u服务器['REQUEST\u URI']$零件=分解(“/”,$url)$dir=“http://”$\u服务器['SERVER\u NAME'];对于($i=0;$i
您是否使用css/js的相对URL?你能在css、js、图像文件中使用绝对路径而不是相对路径吗。这意味着您必须确保这些文件的路径以
http://
或斜杠
/
开头<代码>
也应该有帮助。我的URL说
重写规则不能更改您的PHP代码。它可以重定向到其他URL,但在规则中也没有这样做。