Forcing HTTPS on 'selected' sites in a multi-site install

Hello,

I have added https from Letsencrypt SSL for my domain https://compumatter.com/

Though it works fine, when I click on some links such as 'Contact Us' it immediately launches the normal http:// version.

How can I selectively cause some sites to always redirect to httpS. Ideally this would be an VirtualHost solution or at worst an .htaccess solution and some javascript redirect.

This is something I will be adding to selected other sites too so please offer a suggestion that can be added for more than one site.

All my wordpress sites are using theirname.com and not theirname.myname.com

Thanks.

Jay
CompuMatter

  • Luís

    Hi Jay ,

    Hope you're doing well today!

    I think a plugin like WordPress HTTPS can help you in this task, you are able to select which subsite will use HTTPS:

    https://wordpress.org/plugins/wordpress-https/

    Honestly, I don't have too much experience in "VirtualHost" methods, however, I flagged the SLS team (our code experts ) to get their valuable feedback.

    Since this team deals with more advanced threads it may take them longer to reply.

    Cheers, Luís

  • Jay

    Luis,

    I would prefer not to rely on a plugin for such an important function. If the plugin fails, the entire model falls apart. The plugin in any case hasn't been updated in 2 years. Not a safe bet for me.

    I really feel in todays world with LetsEncrypt on the scene and Google pushing SSL so heavily with OAUTH2 on email sending as well as higher search engine results this has become a priority issue for all web developers that are serious about their business.

    I look forward to hearing what your admin has to say.

    Jay

  • James Morris

    Hello Jay,

    I hope you are well today. I'm working along side my colleague Luís here and I see you're wanting to selectively enable https on subsites in your network using a mapped domain name. This looks like you're already using our Domain Mapping plugin. Since you do not have a specific site associated with this ticket, I cannot be certain.

    Using Domain Mapping, you can change the schema of the mapped domain from http to https. It's built right into the system. Please see the following screenshots.

    https://goo.gl/ueeiNx
    https://goo.gl/0kShzO

    If this is not the setup you are using, would you please enable Support Staff Login so we can take a closer look at your configuration?

    If you don't already know, you can learn how to grant WPMU DEV Support Access at the following link:

    https://premium.wpmudev.org/manuals/wpmu-dev-dashboard-enabling-staff-login/

    Please reply back here once you've enabled access so I will be notified.

    Best regards,

    James Morris

  • Mahlamusa

    Hello Jay,

    I hope you are doing great today. As I was going through some old threads I have noticed that this one is open and we haven't heard back from you with regards to this.

    Did you follow on my colleague James' suggestion with the domain mapping plugin, does that help you achieve your needs for your multi site? I do understand that you said you would not rely on a plugin to achieve this but the domain mapping plugin has lots of benefits and has that functionality built in already.

    If you are using the domain mapping plugin, it will not be a good idea to use additional .htaccess or VirtualHost to achieve something that Domain Mapping already has built in. This may cause redirect issues as most of the redirects in WordPress are done in the default .htaccess and in the WordPress code which does the URL rewrites. The domain mapping plugin extends the capabilities of WordPress but at the same time conforming to WordPress standards.

    Usually, VirtualHosts are intended for standalone websites on the same shared environment, if you prefer to use virtual hosts then you should be familiar with how they work and you should be able to configure the SSL Certificates properly, otherwise you will have unbearable issues. If you insist on not relying on a plugin, try this virtual host config file:

    <VirtualHost *:80>
        ServerName example.com
        ServerAlias http://www.example.com
        Redirect / https://example.com/
    	DocumentRoot "/path/to/multisite/wordpress_root"
    </VirtualHost>
    <VirtualHost *:443>
        ServerName freesoftwareservers.com
        ServerAlias *.freesoftwareservers.com
    	Redirect / https://example.com/
    	DocumentRoot "/path/to/multisite/wordpress_root"
    
    	#SSl
    	SSLEngine on
    	SSLCertificateFile        "/path/to/file.crt"
    	SSLCertificateKeyFile     "/path/to/file.key"
    	SSLCertificateChainFile   "/path/to/file.crt"
    </VirtualHost>

    I hope this helps. Please let us know if you need more help or have other concerns.

    I hope you enjoy the rest of your day.

    Cheers,
    Mahlamusa