I'm speaking at WordCamp Brisbane 2019Get Your Ticket

Blog

How To Force HTTPS With Your .htaccess File

Divi WordPress Theme

It is becoming increasingly important to have an SSL certificate installed on your website. Browsers such as Chrome and Safari are actively marking sites without an SSL certificate as “insecure” and Google now considers HTTPS a ranking factor in their algorithm.

But just having an SSL certificate installed won’t automatically apply the benefits of an SSL certificate to your site. Unless your traffic is being redirected to the HTTPS URL of your site, users can still view your site without HTTPS. If you have an established site, it’s highly likely you’ve already got plain HTTP URLs indexed by search engines or linked to from other sites.

While some servers or content management systems may have settings to force HTTPS, if your site is running on an Apache server the best way to force HTTPS is to add a redirect to your .htaccess file. Simply copy the below code into your .htaccess file, making sure to place it above any other rules in the file.

Did you find this post useful?

YesNo