Force all requests to HTTPS on Cloudways

I found it a little difficult to get a proper HTTPS redirect working on Cloudways. All of the other mod_rewrite rules for checking non-SSL traffic seemed to end in a redirection loop.

This turns out the be the code that works:

Put that at the start of your .htaccess  file and you should be away.

Test it first without the  =301 on line 5, just in case you’ve done something wrong. Those permanent redirects will cache in your browser and can be a real pain!

Once everything looks like it’s working as it should, add the 301 back in there.

Leave a Reply

Your email address will not be published. Required fields are marked *