Really Simple SSL

Preventing subdomains or add-on domains from getting forced to https

If you have several subdomains or add-on domains but do not use WordPress Multisite, you’ll need a way to prevent Really Simple SSL from forwarding all subdomains to https. That is, if these subdomains do not have an SSL certificate of course.

1. In settings/ssl, disable the wp redirect and enable the .htaccess 301 redirect.

2. Go to Really Simple SSL settings and check Stop editing the .htaccess file. Save this setting. Alternatively, you can add this line to your wp-config.php

define( 'RLRSSSL_DO_NOT_EDIT_HTACCESS' , TRUE );.

They both do the same same thing; they stop Really Simple SSL from editing your .htaccess file henceforth.

3. Now add the following conditions to the rewrites currently existing in your .htaccess, between the Really Simple SSL markers. Add them after the first SSL RewriteCond, but before the actual RewriteRule:

RewriteCond %{HTTP_HOST} ^domain.com [OR]
RewriteCond %{HTTP_HOST} ^www.domain.com

So your Really Simple SSL rule changes from this below (the exact lines can differ between different servers, this is an example)

# BEGIN rlrssslReallySimpleSSL rsssl_version[2.3.8]
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP:X-Forwarded-Proto} !https #this line might be different on your site
RewriteRule ^(.*)$ https://%{HTTP_HOST}%/$1 [R=301,L]
</IfModule>
# END rlrssslReallySimpleSSL

to this below here.

# BEGIN rlrssslReallySimpleSSL rsssl_version[2.3.8]
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTP_HOST} ^domain.com [OR]
RewriteCond %{HTTP_HOST} ^www.domain.com
RewriteRule ^(.*)$ https://%{HTTP_HOST}%/$1 [R=301,L]
</IfModule>
# END rlrssslReallySimpleSSL

Where domain.com and http://www.domain.com is the domain you still want SSL on.

Note that your version number may differ from the one here. The first rewrite condition, which in this case is HTTP:X-Forwarded-Proto, may differ from site to site.

Rogier

Rogier

Related articles

Join our mailing list - 8 Tips & Tricks in your inbox over the next 8 weeks!