【问题标题】:Cannot use Network Admin (Dashboard) on Multi-site after 301 www redirect301 www 重定向后无法在多站点上使用网络管理员(仪表板)
【发布时间】:2012-08-07 15:51:53
【问题描述】:

我最近在 .htaccess 上为我当前正在运行的博客多站点添加了 301 重定向非 WWW 到 WWW(Wordpress 博客位于“mysite.com/home/”目录下),在所有更改后它们似乎工作正常以下这 3 个文件:

.HTACCESS

# Redirect Non-WWW to WWW
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mysite\.com\home
RewriteRule ^(.*)$ http://www.mysite.com/home/$1 [R=301,L]
# END Redirect Non-WWW to WWW

RewriteEngine On
RewriteBase /home/
RewriteRule ^index\.php$ - [L]

# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

# 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).*) $1 [L]
RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
RewriteRule . index.php [L]

WP-CONFIG.PHP

改变

define('DOMAIN_CURRENT_SITE', 'mysite.com');

改成

define('DOMAIN_CURRENT_SITE', 'www.mysite.com');

FUNCTIONS.PHP(主题)

更改自

update_option('siteurl','http://mysite.com/home');
update_option('home','http://mysite.com/home');
global $oswcPostTypes;

改成

update_option('siteurl','http://www.mysite.com/home');
update_option('home','http://www.mysite.com/home');
global $oswcPostTypes;

我可以像往常一样查看我的站点并登录到每个站点仪表板但无法使用网络选项卡:我的站点 > 网络管理员 > 仪表板、站点、用户。为了能够在不使用任何插件或更改数据库中的所有数据的情况下使用多站点上的网络选项卡,是否还有其他地方需要更改?

【问题讨论】:

标签: .htaccess wordpress


【解决方案1】:

您的重定向似乎状况不佳:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^mysite\.com\home
RewriteRule ^(.*)$ http://www.mysite.com/home/$1 [R=301,L]

%{HTTP_HOST} 是“Host:”标头请求中的内容,它只包含一个主机名(有时还包含一个端口),您不能在其中包含 URI 路径。尝试将其更改为:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^mysite\.com
RewriteRule ^/?home/(.*)$ http://www.mysite.com/home/$1 [R=301,L]

【讨论】:

    【解决方案2】:

    您的值 "$current_blog->domain, $current_site->domain" 必须与 /wp-admin/network/admin.php 第 20 行中的 "$current_blog->path, $current_site->path" 相同。

    在域和路径列中检查您的 *_wp_blogs 表。

    将您的域值从 mysite.com 更新为 www.mysite.com

    【讨论】:

      猜你喜欢
      • 2014-09-28
      • 1970-01-01
      • 2019-02-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-10-03
      • 2023-01-14
      相关资源
      最近更新 更多