Some of these steps can be completed via command line with wp-cli if installed by using commands generated from this tool. To find out if wp-cli is installed, try running wp cli version
.
Adding the Cert
These instructions are for SiteGround hosting with a free Let’s Encrypt certificate. Other hosts support of Let’s Encrypt and steps will vary.
- Login to SiteGround admin
- Select the Management account that includes the hosting domain
- Go to cPanel
- Click Let’s Encrypt from Security section
- Select domain, tick Let’s Encrypt SSL, and click Install
- Test HTTPS connection
Updating resource links to https
Consider using wp-cli and commands generated by this tool instead for a quicker simpler and more secure approach.
- In cPanel, select phpMyAdmin from Databases section
- Export backup of MySQL db
- SSH to server
- Copy
SRDBM
to root folder (download here) - Perform the following Dry Run search and replace tasks, and perform Live Run if no errors. NOTE: See bottom of these instructions if CLI f/r required
- Find out if preferred sub-domain is @ or www – f/r to the preferred one
http%3A%2F%2Fdomain.tld
tohttps%3A%2F%2Fdomain.tld
http:\\/\\/domain.tld
tohttps:\\/\\/domain.tld
http:\/\/domain.tld
tohttps:\/\/domain.tld
http://domain.tld
tohttps://domain.tld
- Test for green padlock
- DELETE SRDBM
Check config
Check in wp-config.php
file for the following, update to https
if necessary:
define('WP_HOME', 'http://domain.tld');
define('WP_SITEURL', 'http://domain.tld');
Forcing HTTPS Connection via .htaccess
- SSH to server
- Make backup of .htaccess file
- Add rewrite rule:
RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://domain.tld/$1 [R=301,L]
- Test forced HTTPS
Forcing HTTPS Connection via Apache .conf file
- SSH to server
- Make backup of
.conf
file - Change *:80 vhost to:
<VirtualHost *:80> ServerName domain.tld Redirect / https://domain.tld/ </VirtualHost>
- Test forced HTTPS (confirm works with any URL)
Using SRDBM from command line
php srdb.cli.php -h "localhost" -n "db_name" -u "db_user" -p "db_pass" -s "http:\/\/domain.tld" -r "https:\/\/domain.tld" -z
The -z
switch is for dry run, be sure to re-run without if no errors.