How to Move WordPress to HTTPS – in Simple, Easy-to-Understand Steps

All websites I build have been set up on HTTPS, by default, for some years now.

HTTPS is an absolute necessity if you’re running a shop on your site but, even without a shop, you will benefit from greater security, better performance and higher search engine rankings – Google has been giving better rankings to HTTPS sites since 2014.

The video below goes through the steps to migrate your WordPress website to HTTPS but, in the interests of brevity, I did not include the additional steps you need to take if you are using Cloudflare or a similar CDN service.

Cloudflare or similar services

When you use Cloudflare, or any similar CDN service, access to your website goes via their server rather than direct to your server.

So when you set up an HTTP site on one of those services the connection setting (between Cloudflare and your server) is flexible – they try to use HTTPS but fall back to HTTP if they can’t.

The result is that when you first move your site to HTTPS without changing the settings in your CDN provider you will not be able to access it.

The solution is log in to your CDN provider and change the connection setting to ‘Strict’ or ‘Full’ SSL.

If you’re still having problems after doing that, then make sure to clear all caches – this includes caches on your CDN provider, your server and your browser.

Code snippets for the .HTACCESS and wp-config.php files

In the video I refer to two snippets of code that need to be added to two files on your server during the migration process. You can add these snippets either via SFTP or via the File Manager in your hosting cPanel.

Code for the .HTACCESS file:

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Code for the wp-config.php file:

define('FORCE_SSL_ADMIN', true);

This must be placed before the ‘That’s all, stop editing, happy blogging’ line.

How to migrate your WordPress website to HTTPS

If you would like a print out of the steps I covered in the video, along with the additional steps for Cloudflare (or similar) and what you need to do if your site is registered with Google Search Console, you can:

Download the PDF here.

If you have any questions please leave a comment below!

Martin Malden

Share the love: