我正在尝试找出为什么我的 Wordpress 安装会进行 10 次重定向并导致会话崩溃的问题。我从 Apache 日志中得到的提示是:
[perdir /usr/www/users/server/server.org/] add per-dir prefix: index.php -> /usr/www/users/server/server.org/index.php
[rewrite:trace2] [pid 79207:tid 140188445558528] mod_rewrite.c(486): [client xxxx:46452] 185.93.229.14 - - [server.org/sid#7f805e2bda80][rid#7f805eabd0a0/initial] [perdir /usr/www/users/server/server.org/] trying to replace prefix /usr/www/users/server/server.org/ with /
[rewrite:trace5] [pid 79207:tid 140188445558528] mod_rewrite.c(486): [client xxxx:46452] 185.93.229.14 - - [server.org/sid#7f805e2bda80][rid#7f805eabd0a0/initial] strip matching prefix: /usr/www/users/server/server.org/index.php -> index.php
[rewrite:trace4] [pid 79207:tid 140188445558528] mod_rewrite.c(486): [client xxxx46452] 185.93.229.14 - - [rid#7f805eabd0a0/initial] add subst prefix: index.php -> /index.php
[rewrite:trace1] [pid 79207:tid 140188445558528] mod_rewrite.c(486): [client xxxx:46452] 185.93.229.14 - - [server.org/sid#7f805e2bda80][rid#7f805eabd0a0/initial] [perdir /usr/www/users/server/server.org/] internal redirect with /index.php [INTERNAL REDIRECT]
据我所知,server.org 正在重定向到 /index.php 并创建一个循环,但我不知道这是怎么发生的。有什么方法可以检测它吗?
这是我的.htaccess
RewriteEngine On
# SSL and WWW
RewriteCond %{ENV:HTTPS} =on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule .* https://%1%{REQUEST_URI} [R=301,L]
# No SSL and WWW
RewriteCond %{HTTPS} !=on
RewriteCond %{ENV:HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule .* https://%1%{REQUEST_URI} [R=301,L]
# No SSL and no WWW
RewriteCond %{HTTPS} !=on
RewriteCond %{ENV:HTTPS} !=on
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} ^/(de|en|es|fr|ru)/index\.php$
RewriteRule ^(.*)$ /index.php [L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]