multisite network admin , my site link to non-www url

1.2k views Asked by At

I using multisite wordpress and yesterday I changed from http to https. At first I got many problem about updating url. So I researc and applied a few method such as query change https direct on MySQL, setup .htacess following :

RewriteEngine On
RewriteBase /

RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

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]

also using update on functions.php :

update_option('siteurl','https://www.//example.com');
update_option('home','https://www.example.com');

Finally all link is working good.

But I got one problem at Netword admin menu

Here is my screen:

How can I fix Network admin menu to appear https://www. ?

Thanks

1

There are 1 answers

2
Samuel On

Your site is MultiSite. Network admin menu is part of it.

You should use update_site_options to update URLs globally

As well, read following instruction about how completely switch from HTTP to HTTPS

Some highlight from there:

The first step is to enable SSL for administration. This is well documented within Wordpress, just add the following statement to your wp-config.php:

define('FORCE_SSL_ADMIN', true);

The second step is to set the relative options, settings, and constants to enable optional support for private browsing.

define('WP_SITE_URI',($_SERVER["HTTPS"]?"https://":"http://").$_SERVER["SERVER_NAME"]);
define('WP_SITEURI', ($_SERVER["HTTPS"]?"https://":"http://").$_SERVER["SERVER_NAME"]);

You could abstract out your domain if you'd like. This example assumes your blog is located in the top directory. Add a sub-directory at the end if you require. Then somewhere BEFORE the include for 'wp-settings' insert:

define("WP_CONTENT_URL", WP_SITE_URI . "/wp-content");

Then after the include of 'wp-settings' add:

wp_cache_set("siteurl_secure", "https://" . $_SERVER["SERVER_NAME"], "options");
wp_cache_set("home", WP_SITE_URI, "options");
wp_cache_set("siteurl", WP_SITE_URI, "options");

The last change is implemented as a plugin.

<?php
/* Plugin Name: Content over SSL
 * Description: Re-write content URIs to use the appropriate protocol
 * Author: Me
 * Version: .1
 */
 
add_filter('the_content', 'my_ssl');
 
function my_ssl($content) {
  if (isset($_SERVER["HTTPS"]))
    $content = ereg_replace("http://" . $_SERVER["SERVER_NAME"], "https://" . $_SERVER["SERVER_NAME"], $content);
  return $content;
}
?>