The multisite mode in this case is when the main domain and its subdomains work in the same base and the subdomains are a mirror of the main site. If I add a standard 301 redirect to .htaccess then subdomains via http subdomains start redirecting to the main site.
This is correct because the redirect looks like this one:
RewriteCond %{SERVER_PORT} ^80$ [OR]
RewriteCond %{HTTP} =on
RewriteRule ^(.*)$ https://domain.com/$1 [R=301,L]
In the case of multisite, delete the example above and then add the following code to functions.php:
function force_https () {
if ( !is_ssl() ) {
wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 301 );
exit();
}
}
add_action ( 'template_redirect', 'force_https', 1 );
Now the main site and all multisite ‘clone’ subdomains have their own redirects.
WEBinP Your guide to resolving CMS optimization, Web Development and SEO problems