How to Force https on WordPress

To force https: on a WordPress Website without a plugin, you can add the code below to the top of your current .htaccess file. I would do this when you first install your WordPress site to avoid the mixed content error.

If you do find yourself with mixed content errors add https: to an older site you should look at a plugin like – SSL Insecure Content Fixer

The Code

# Begin Force https://
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE] 
#End Force https://

How to – Manually

The best way to edit your .htacess file is via FTP/SFTP and edit the file directly. This is my preferred way to add functionality to my WordPress sites, it adds next to nothing to slow down the speed of your WordPress site.

As I am one of the millions of Windows users I use WinSCP an incredible windows FTP/SFTP program, I have also used Filezilla on many occasions too

If you can add functionally without a third-party plugin you should!

How to – with a plugin

You could add the code via a .htaccess editor plugin like – Htaccess Editor

But if you’re going to add a plugin to edit a file to add this functionality you could just add a plugin to add the forced https: like – Really Simply SSL

View more WordPress Tips & Tricks

Leave a Reply

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


×