Cas
Cas

Reputation: 55

Cannot use Network Admin (Dashboard) on Multi-site after 301 www redirect

I have recently added the 301 redirect non-WWW to WWW on .htaccess for my current running blog multisite (Wordpress blog resides under "mysite.com/home/" directory), they seem to work fine after all the changes in those 3 files below:

.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

Change From

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

Change To

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

FUNCTIONS.PHP (OF THE MAIN THEME)

Change From

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

Change To

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

I could be able to view my sites as usual and log-in to each Site Dashboard BUT CANNOT BE ABLE TO USE the network tab: My Sites > Network Admin > Dashboard, Sites, Users. Is there anywhere else needed to change in order to be able to use the network tab on multisite without using any plugin or changes all the data in the database?

Upvotes: 1

Views: 2784

Answers (2)

Agus Nurwanto
Agus Nurwanto

Reputation: 1

your value "$current_blog->domain, $current_site->domain" must be same with "$current_blog->path, $current_site->path" in /wp-admin/network/admin.php line 20.

Check your *_wp_blogs table in domain and path column.

Update your domain value from mysite.com to www.mysite.com

Upvotes: 0

Jon Lin
Jon Lin

Reputation: 143966

Your redirect seems to have a bad condition:

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

The %{HTTP_HOST} is what's in the "Host:" header request and it only contains a hostname (and sometimes a port), you can't have URI paths in there. Try changing it to:

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

Upvotes: 3

Related Questions