SSL in tandem with Domain Mapping: What redirect code is required?

I've been using Domain Mapping successfully for nearly a year, but recently I moved my whole site to https. I'd appreciate some help in knowing what redirects I need to make the plugin work with the new SSL.

The site has 5 main subsites, all of which need to be on the SSL. But I also have a number of sub-sites which should not use the SSL and should be domain mapped.

As an example, I want the root site to redirect all non-https traffic to http, and I want the sub-site http://www.thepodcasthost.com/university/ to do the same - all http to redirect to https.

But, for eg., http://www.thepodcasthost.com/abcde/ is mapped to abcde.com and I need it NOT to use https because if I do so, then there's a security warning when trying to load https://www.abcde.com.

Can you tell me what .htaccess rules I need to manage this, and what settings within domain mapping are also required? I know it is set to manage https and http, but I'm unsure how this would work in this situation.

Thanks for the help

  • Adam Czajczyk

    Hey Colin,

    I hope you're well today and thank you for your question!

    I think the most robust solution in case of such a "mixed domains" setup would be to keep all the "force https" options for Domain Mapping disabled and keep "Administration" and "Login" mapping options set original domain.

    This way you'll make sure that none of the non-SSL sites will be forced to https:// connections, therefore there shouldn't be any "security warnings".

    The next step would be to take care that all the domains covered by SSL certificate (those that are to be available under https:// connection) are mapped as "https://" instead of "http://". This can be selected during the mapping procedure.

    Finally, the .htaccess redirection for selected domains (regardless whether these would be mapped or original domains/subdomains):

    RewriteCond %{HTTPS} off
    RewriteCond %{HTTP_HOST} exampledomain\.org$ [NC]
    RewriteRule ^ https://www.examplemydomain.org%{REQUEST_URI}  [R=301,L,NE]

    I think this added right below the "RewriteEngine on" and repeated for each domain that has to be https:// accessible should do the trick.

    I hope that helps!

    Cheers,
    Adam

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.