How to Force HTTPS for WordPress Multi-Site – Per Domain
Use this code for forcing HTTPS (SSL) on multi-site setups where you’re using multiple domain names (using a .htaccess file). This is used if you only want SSL on some of those websites – versus all of them (but since HTTPS is good for all sites, I don’t know why you’d need this anymore but here goes):
RewriteCond %{HTTP_HOST} ^www\.yourdomain\.com
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R=301,L]And then this code goes into the wp-conf.php file:
if ( $_SERVER["HTTP_HOST"] == "yourdomain.com" ) {
define('FORCE_SSL_ADMIN', true);
define('FORCE_SSL_LOGIN', true);
}📄 Download a PDF of This Article
