簡體   English   中英

WordPress 多站點重定向循環

[英]WordPress Multisite redirect loop

我有一個關於 WordPress 多站點的問題。 目前有 2 個站點處於子目錄模式。 一切正常,直到我想訪問以“ ERR_TOO_MANY_REDIRECTS ”結尾的 WordPress 多站點網絡選項卡。 我們同時擁有 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 多站點關注
  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。

如果您能提供任何提示,我們將不勝感激。

提前致謝。

如果您使用 Cloudflare,請從 Cloudflare 帳戶的 SSL/TLS 選項卡中選擇完全加密。 它將解決問題。

SSL 完整

如果您最近移動了站點,請檢查您的數據庫以獲取對舊域的引用並更新到新域。 這包括從 http 移動到 https。

您還可以嘗試在 WordPress 儀表板 > 設置 > 永久鏈接 > 保存中更新永久鏈接

我在 AWS 上使用 lightsail 和帶有子域的 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/configure_app_domain --domain your-domain.com

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM