-4

I've enabled HTTPS on my server by using a Lets Encrypt certificate and I want to make sure anyone going to http://www.example.com is redirected to https://www.exampe.com.

I was attempting to follow the instructions here but one step requires using a command line tool that appears only to work on local WP installs not the WP install on my site.

Basic rundown:

  1. Backup your WP Database
  2. Enable SSL on Dreamhost
  3. Force SSL on WP Admin pages
  4. Replace old http links with https links (this is where CLI is used)
  5. Update .htaccess file with redirect
  6. Update site address in WordPress Settings???

I'm stuck on step 4 and have not attempted to update the site URL in step 6 (suggested in the comments).

2

You can replace your URLs in PHPMyAdmin instead - make sure you have backed up your database though.

You'd need to change this code and run it:

UPDATE wp_posts SET guid = replace(guid, 'http://www.old-url.co.uk','https://www.new-url.co.uk');

UPDATE wp_posts SET post_content = replace(post_content, 'http://www.old-url.co.uk', 'https://www.new-url.co.uk');

You might be able to bypass this step if you have a secure content fixer plugin installed - some of these will force the SSL on all URLs and fix any paths to css files etc. iThemes security also has a force ssl feature but I dont think it corrects css/js files and external URLs.

Step 5 is simply going to Settings > General and changing the two URLs in there to have https.

Hope that helps :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.