admin管理员组

文章数量:1203411

I installed MultiSite with the URL set as , but now I want to force all requests to go over HTTPS, so I'm trying to change the URL to be . 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.

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.

Share Improve this question asked Apr 10, 2012 at 0:20 Ian DunnIan Dunn 4,8575 gold badges43 silver badges69 bronze badges
Add a comment  | 

3 Answers 3

Reset to default 2

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?

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

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]

本文标签: sslSwitching MultiSite installation from HTTP to HTTPS