1

我最近为我当前正在运行的博客多站点(Wordpress 博客位于“mysite.com/home/”目录下)添加了 301 重定向非 WWW 到 .htaccess 上的 WWW,在这 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;

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

4

2 回答 2

3

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

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

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

RewriteEngine on
RewriteCond %{HTTP_HOST} ^mysite\.com
RewriteRule ^/?home/(.*)$ http://www.mysite.com/home/$1 [R=301,L]
于 2012-08-07T18:35:40.350 回答
0

您的值 "$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

于 2017-02-26T01:11:07.880 回答