【发布时间】:2020-10-13 20:48:30
【问题描述】:
我正在使用 wordpress 应用程序并在跨平台 Web 服务器 xampp 上运行它。该网站运行了几个星期。突然,URL 开始返回 err_too_many_redirects。该网站只是陷入了无限重定向循环。
在浏览器上打开 URL http://wordpress.example.com 会重定向到 http://wordpress.example.com/login?redirect_to=http%3A%2F%wordpress.example.com%2F 并继续在 URL 末尾添加 redirect_to=http%3A%2F%wordpress.example.com%2F,直到到达 apache GET 限制。最后webserver返回错误HTTP 414 “Request URI too long”
我检查了我的 xampp(apache、mysql、php)的设置和配置;全部不变意味着默认设置。
apache 日志读取
"GET /?redirect_to=http%3A%2F%2Fwordpress.example.com%2F%3Fredirect_to%3Dhttp%253A%252F%252Fwordpress.example.com%252F HTTP/1.1" 302 - "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36"
我重新启动了网络服务器
检查了.htaccess 设置
<IfModule mod_rewrite.c>
RewriteEngine On
# RewriteBase /
# Force Domain & SSL
# RewriteCond %{SERVER_PORT} !^443 [OR]
# Security Fix, no names for you my friend
RewriteCond %{QUERY_STRING} author=\d
RewriteRule ^ /? [L,R=301]
# If the requested filename exists, simply serve it.
# We only want to let Apache serve files and not directories.
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .* - [L]
# Admin 404 Fix
RewriteRule ^wp/wp-admin/$ wp/wp-admin/index.php [L]
# Rewrite all other queries to the Wordpress.
RewriteRule .* wp/index.php [L] # Use if live env is up
# RewriteRule .* update.html [L] # Use if updating live env
</IfModule>
wp-config.php
define('WP_HOME','http://wordpress.example.com');
define('WP_SITEURL','http://wordpress.example.com/wp');
附加说明:我既没有使用任何 SEO 插件或任何重定向,也没有使用安全的 https。 此外,GET 没有表格。站点内的所有请求都使用 POST。
【问题讨论】: