나는 내 웹 사이트의 루트 디렉토리에 .htaccess 파일이 있고, 그 내용은 다음과 같습니다 : friends.php에 대한 재 작성 규칙을 제외하고htaccess로 LimitInternalRecursion 오류
Options +SymLinksIfOwnerMatch -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase/
RewriteCond %{HTTP_HOST} !^my-domain\.com
RewriteRule (.*) https://my-domain.com/$1 [R=301,L]
#Check if connection is HTTPS
RewriteCond %{HTTPS} !=on
#Redirect HTTP to HTTPS
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
# To externally redirect /dir/foo.php to /dir/foo
RewriteCond %{THE_REQUEST} ^GET\s([^.]+)\.php\s [NC]
RewriteRule^%1 [R,L]
# To internally forward /dir/foo to /dir/foo.php
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*?)/?$ $1.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}.php !-d
RewriteRule ^user\/([a-zA-Z0-9_\-\.]+)/?$ /profile.php?username=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}.php !-d
RewriteRule ^friends\/([a-zA-Z0-9_\-\.]+)/?$ /friends.php?username=$1 [L]
ErrorDocument 400 /errors/1.php
ErrorDocument 401 /errors/2.php
ErrorDocument 403 /errors/2.php
ErrorDocument 404 /errors/4.php
ErrorDocument 500 /errors/6.php
모두가 노력하고 있습니다.
my-domain.com/user/example로 이동하면 my-domain.com/profile.php?username=example의 내용을 성공적으로 가져옵니다.
그러나, 내 도메인/친구/예로 이동, 그것은 나에게 내부 서버 오류를 제공하고, 나는 이것이 내 아파치 오류 로그입니다 참조 :
디버그 로그에서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 다음 줄을 찾으십시오 :
[Sun May 18 00:42:12 2014] [error] [client 122.175.169.57] 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.
[Sun May 18 00:42:12 2014] [debug] core.c(3112): [client ###] r->uri = /friends/example.php.php.php.php.php.php.php.php.php.php
[Sun May 18 00:42:12 2014] [debug] core.c(3118): [client ###] redirected from r->uri = /friends/example.php.php.php.php.php.php.php.php.php
[Sun May 18 00:42:12 2014] [debug] core.c(3118): [client ###] redirected from r->uri = /friends/example.php.php.php.php.php.php.php.php
[Sun May 18 00:42:12 2014] [debug] core.c(3118): [client ###] redirected from r->uri = /friends/example.php.php.php.php.php.php.php
[Sun May 18 00:42:12 2014] [debug] core.c(3118): [client ###] redirected from r->uri = /friends/example.php.php.php.php.php.php
[Sun May 18 00:42:12 2014] [debug] core.c(3118): [client ###] redirected from r->uri = /friends/example.php.php.php.php.php
[Sun May 18 00:42:12 2014] [debug] core.c(3118): [client ###] redirected from r->uri = /friends/example.php.php.php.php
[Sun May 18 00:42:12 2014] [debug] core.c(3118): [client ###] redirected from r->uri = /friends/example.php.php.php
[Sun May 18 00:42:12 2014] [debug] core.c(3118): [client ###] redirected from r->uri = /friends/example.php.php
[Sun May 18 00:42:12 2014] [debug] core.c(3118): [client ###] redirected from r->uri = /friends/example.php
[Sun May 18 00:42:12 2014] [debug] core.c(3118): [client ###] redirected from r->uri = /friends/example
내 규칙에 어떤 문제가 있는지 알 수 없습니다./user/example에 대한 다시 쓰기 규칙이 정상적으로 작동합니다. ,/friends /는 같은 규칙을 가지고 있지만, 위의 오류를 나에게 준다.
_ "여기는 무엇이 있습니까?"- 오류 메시지는 이미 재 작성 과정에서 정확히 무엇이 일어나는지 확인하기 위해해야한다고 말했습니다. – CBroe
Btw.,'RewriteCond'는 그 뒤를 따르는 하나의'RewriteRule'에 대해서만 작동합니다 - 실제로 후행 슬래시가 다른 두 개의 연속적인 RewriteRules의 여러 조합 중 _both_에 적용 할 것을 기대합니다. RewriteCond를 다시 _repeat_하거나 두 규칙을 하나의 것에 집약해야합니다 (이것은 후행 슬래시 _optional_를 사용하여 쉽게 완료됩니다). – CBroe
@CBroe 오류로 인해 많은 수의 리디렉션이 있음을 알고 있습니다. 그러나 내가 모르는 것은 오류의 원인은 무엇입니까? –