Switching MultiSite installation from HTTP to HTTPS

I installed MultiSite with the URL set as http://example.com, but now I want to force all requests to go over HTTPS, so I'm trying to change the URL to be https://example.com. I've gone through the database and updated all the siteurl and home values to have https, but the site still loads over HTTP, instead of being redirected to HTTPS.

I know that I could setup some htaccess rules, but that's prone to errors. In regular installations WordPress will automatically redirect all requests to the canonical URLS defined in the siteurl and home settings, so I'm assuming that MultiSite does too.

Topic home-url site-url multisite https ssl Wordpress

Category Web


I changed the rules specific to a host. But now redirects all other blogs to this one. Changed to "%{HTTP_HOST}" to a specific domain and kept the "%{REQUEST_URI}" part.

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://gezentiyiz.biz%{REQUEST_URI} [L,R=301]

IMHO adding additional RewriteRule lines for other domains may solve the problem but I wonder is there any easy way to do it. Because each time a blog site is created we need to modifiy the .htaccess file???

Edit: I solved the problem changing the RewriteRule like this:

RewriteRule http://gezentiyiz.biz%{REQUEST_URI} https://gezentiyiz.biz%{REQUEST_URI} [L,R=301]

I encountered the same issue: with WordPress multisite, there is no option or setting that defines if a site domain is HTTP or HTTPS. Even after replacing all occurrences in the database, a site visitor can still enter and navigate the site in HTTP, without being redirected to HTTPS.

The following simple solution worked for me: I added this mod_rewrite rule to my .htaccess file, just before the WordPress specific rewrite rules.

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Since this rule isn't defining a specific domain, it's perfect for the needs of WordPress multisite.

I found this rule in the following thread: https://stackoverflow.com/questions/4398951/force-ssl-https-using-htaccess-and-mod-rewrite


There are plugins to set the site to SSL. Why not use one of them?

And you do have an SSL certificate installed and active?

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.