php WordPress多站点重定向循环

mv1qrgav  于 2022-11-21  发布在  PHP
关注(0)|答案(3)|浏览(137)

我有一个关于WordPress多站点的问题。目前有2个站点在子目录模式。一切工作正常,直到我想访问WordPress多站点网络标签,最终与“ERR_TOO_MANY_REDIRECTS"。我们有HTTPS和HTTP网站的工作,但目前没有强制重定向。
我们的.htacces如下所示:

# START XML RPC BLOCKING
<Files xmlrpc.php>
Order Deny,Allow
Deny from all
</Files>
# FINISH XML RPC BLOCKING

#
<IfModule mod_expires.c>
# Enable expirations
ExpiresActive On
# Default directive
ExpiresDefault "access plus 1 month"
# My favicon
ExpiresByType image/x-icon "access plus 1 year"
# Images
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
# CSS
ExpiresByType text/css "access plus 1 month"
# Javascript
ExpiresByType application/javascript "access plus 1 year"
</IfModule>

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

#RewriteCond %{SERVER_PORT} 80
#RewriteCond %{REQUEST_URI} www
#RewriteRule ^(.*)$ https://www.oursite.cz/$1 [R,L]

#RewriteCond %{HTTPS} !=on
#RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]

RewriteRule ^index\.php$ - [L]
RewriteRule wp-content/thesis/skins/(.*)/css.css wp-admin/admin-post.php?action=thesis_do_css

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
</IfModule>

我们的wp-config.php是这样的:

/**
 * WordPress Localized Language, defaults to English.
 *
 * Change this to localize WordPress. A corresponding MO file for the chosen
 * language must be installed to wp-content/languages. For example, install
 * de_DE.mo to wp-content/languages and set WPLANG to 'de_DE' to enable German
 * language support.
 */
//define('WPLANG', '');

/**
 * For developers: WordPress debugging mode.
 *
 * Change this to true to enable the display of notices during development.
 * It is strongly recommended that plugin and theme developers use WP_DEBUG
 * in their development environments.
 */
define('WP_DEBUG', false);
define('FORCE_SSL_ADMIN', false);

/* Multisite */
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', 'www.oursite.cz');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

/* That's all, stop editing! Happy blogging. */

/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
    define('ABSPATH', dirname(__FILE__) . '/');

/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');

到目前为止,我们尝试了以下方法,但没有任何帮助:

  1. wordpress multisite concerns
  2. https://wordpress.org/support/topic/wp-multisite-too-many-redirects-on-wp-admin/
    目前运行的WordPress版本4.8.2,但WordPress已经更新了几次,多站点创建了相当一段时间前(仍然有同样的问题)。服务器是Apache 2.2.31和PHP 5.4.44。
    如果您能提供一些建议,我们将非常感激。
    先谢谢你。
gopyfrb3

gopyfrb31#

如果您使用的是Cloudflare,请从Cloudflare帐户的SSL/TLS选项卡中选择完全加密。

ippsafx7

ippsafx72#

如果您最近移动了网站,请检查数据库中对旧域的引用,并更新到新域。这包括从http移动到https。
您也可以尝试在WordPress Jmeter 板〉设置〉永久链接〉保存中更新永久链接

b0zn9rqh

b0zn9rqh3#

我添加了相同的问题使用lightsail在AWS和WordPress多站点与子域。
我是这样解决的:
1.创建一个.htaccess文件并粘贴内容nano /opt/bitnami/wordpress/.htaccess

RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,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]

1.使用以下命令更改域:*sudo /opt/bitnami/配置应用程序域--域your-domain.com *

相关问题