简体   繁体   English

WordPress 多站点重定向循环

[英]WordPress Multisite redirect loop

I have a question about WordPress multisite.我有一个关于 WordPress 多站点的问题。 Currently have 2 sites in sub-directory mode.目前有 2 个站点处于子目录模式。 Everything works fine until I wanted to access the WordPress Multisite Network tab which ends up with " ERR_TOO_MANY_REDIRECTS ".一切正常,直到我想访问以“ ERR_TOO_MANY_REDIRECTS ”结尾的 WordPress 多站点网络选项卡。 We have both HTTPS and HTTP sites working, yet currently not forcing redirect.我们同时拥有 HTTPS 和 HTTP 网站,但目前不强制重定向。

Our .htacces looks like:我们的.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>

and Our wp-config.php is like this:而我们的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');

So far we have tried following, but nothing helped:到目前为止,我们已经尝试了以下操作,但没有任何帮助:

  1. wordpress multisite concerns wordpress 多站点关注
  2. https://wordpress.org/support/topic/wp-multisite-too-many-redirects-on-wp-admin/ https://wordpress.org/support/topic/wp-multisite-too-many-redirects-on-wp-admin/

Currently running WordPress Version 4.8.2, but the WordPress has been updated few times and the Multisite was created quite a while ago (still with the same problem).目前正在运行 WordPress 版本 4.8.2,但是 WordPress 已经更新了几次,多站点是很久以前创建的(仍然有同样的问题)。 Server is Apache 2.2.31 and PHP 5.4.44.服务器是 Apache 2.2.31 和 PHP 5.4.44。

We would be really grateful if you could provide any tips.如果您能提供任何提示,我们将不胜感激。

Thanks in advance.提前致谢。

If you are using Cloudflare, from SSL/TLS tab of your Cloudflare account, select Full encryption.如果您使用 Cloudflare,请从 Cloudflare 帐户的 SSL/TLS 选项卡中选择完全加密。 It will solve the issue.它将解决问题。

SSL 完整

If you have moved the site recently then check in your database for references to the old domain and update to the new domain.如果您最近移动了站点,请检查您的数据库以获取对旧域的引用并更新到新域。 This includes moving from http to https.这包括从 http 移动到 https。

You could also try updating permalinks in WordPress Dashboard > Settings > Permalinks > Save您还可以尝试在 WordPress 仪表板 > 设置 > 永久链接 > 保存中更新永久链接

I add the same problem using lightsail on AWS and Wordpress multisite with subdomain.我在 AWS 上使用 lightsail 和带有子域的 Wordpress 多站点添加了相同的问题。

I solved it doing this:我这样做解决了它:

  1. Create a .htaccess file and paste content nano /opt/bitnami/wordpress/.htaccess创建一个 .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. Change the domain with: sudo /opt/bitnami/configure_app_domain --domain your-domain.com使用以下命令更改域: sudo /opt/bitnami/configure_app_domain --domain your-domain.com

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM