Blogging Tips

How to migrate a WordPress blog to HTTPS without losing SEO

migrate a WordPress blog to HTTPS

“How do I migrate a WordPress blog to HTTPS without losing SEO?” this is the question I have been getting from bloggers and other website owners for some time now, Rumour has it that Google now choose to index secured sites (sites with https) over unsecured websites. (websites without https).

migrate a WordPress blog to HTTPS
migrate a WordPress blog to HTTPS

I migrated this blog to HTTPS and I must confess, the conversion from my visitors has increased rapidly so I advice you do same as soon as possible, so back to the question on “how to migrate a WordPress blog to HTTPS?” continue reading as I give you the complete guide on how to migrate a WordPress blog to HTTPS.

Another question I get from people is “why do I need to migrate to HTTPS?” so before we continue, I will like to list out some benefits of SSL on your website

NOTE: SSL means Secure Sockets Layer it is the standard security technology for establishing an encrypted link between a web server and a browser(HTTPS).

Benefits of SSL on your website

  • SSL provides greater privacy and security.
  • Visitors feel more comfortable sharing payment details.
  • It reduces the risk that your information will be misused by a third party.

How to migrate a WordPress blog to HTTPS

Having known the benefits of migrating a WordPress website to HTTPS lets get down to the step by step guide on how to migrate a WordPress blog to HTTPS.

1.      Get an SSL certificate for your website

An SSL certificate is an electronic document that verifies your business identity and allows a web server to establish a secure encryption with a visitor’s web browser. There are many SSL certificate providers and options available but it’s advisable you check if your existing web hosting provider offer SSL certificate and also confirm if they can help you with the installation if the certificate.

Before you do that first check if your website or blog has SSL pre-installed by loading the secured version of your site: https://yoursite.com, if your site comes up that means you have SSL pre-installed by your web host. Just continue with step 2.

2.      Redirect all visitors to your secured site

Having gotten your SSL certificate its time to make your site available only on HTTPS, To do that you will need to add some codes to your .htaccess

Copy and paste the code below

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

If the line “RewriteEngine On” already exist in your .htaccess then there is no need adding it again, just add the other two lines of codes immediately under it then save.

Now reload your site without adding HTTPS and see if it redirects to the secured version of your site, if it did then you can continue to step 3.

3.      Updating your WordPress settings

After redirecting all visitors to the secured version of your site, it’s also good to let WordPress know that you now use HTTPS. To do that log into your WordPress site under “Settings” click on “General Settings” adjust the values for WordPress Address (URL) and Site Address (URL) to their HTTPS version

See Screenshots below:

wordpress setting ( Migrate a wordpress blog to HTTPS )
WordPress setting ( Migrate a WordPress blog to HTTPS )

4.      Update all content on your blog to use HTTPS

At this point we are almost done migrating our to WordPress blog to HTTPS, Now we have to update all the contents to use our HTTPS, I know that sounds like a hard task but not to worry, just with few lines of codes, we will be done with that.

Login to your PHPMyAdmin (or any other SQL tool your web host provides) and execute the below queries on your WordPress database

NOTE: Ensure to backup your database before executing queries. If things go wrong you can restore your previous database.

# Update self-hosted embeds (images, iframes, scripts, etc.)
UPDATE wp_posts SET post_content = REPLACE(post_content, 'http://yoursite.com', 'https://yoursite.com');
UPDATE wp_posts SET post_content = REPLACE(post_content, 'http://www.yoursite.com', 'https://www.yoursite.com');

# Update internal pingbacks
UPDATE wp_comments SET comment_author_url = REPLACE(comment_author_url, 'http://yoursite.com', 'https://yoursite.com');
UPDATE wp_comments SET comment_author_url = REPLACE(comment_author_url, 'http://www.yoursite.com', 'https://www.yoursite.com');

# Update YouTube embeds
UPDATE wp_posts SET post_content = REPLACE(post_content, 'http://www.youtube.com', 'https://www.youtube.com');
UPDATE wp_posts SET post_content = REPLACE(post_content, 'http://img.youtube.com', 'https://img.youtube.com');

# Update Vimeo embeds
UPDATE wp_posts SET post_content = REPLACE(post_content, 'http://player.vimeo.com/', 'https://player.vimeo.com/');

# Update Flickr embeds
UPDATE wp_posts SET post_content = REPLACE(post_content, 'http://farm', 'https://farm');

# Update Slideshare embeds
UPDATE wp_posts SET post_content = REPLACE(post_content, 'http://www.slideshare.net', 'https://www.slideshare.net');

If you successfully executed the queries then the mixed content warnings should be gone and you will get a green lock by the address bar just like the one in the screenshot below: 

green lock ( migrate a wordpress blog to HTTPS )
green lock ( migrate a WordPress blog to HTTPS )

If you do still get mixed content warnings (check for a little shield in the Chrome Address Bar) open the DevTools Console for more information: it could be – and I had this – that a CSS file still references an HTTP:// URL. Manually fix all those errors one by one until you get the green lock icon.

That’s all on how to migrate a WordPress blog to HTTPS.

If along the line you experience any issues, you can contact me for help or also drop a comment using the comment box below, also use the comment box to share your thoughts comments and critics.

Be social and share this post on social media to help others use the social media share button below.

#WealthyFlamez

Tagged , , , , , ,

Leave a Reply

Your email address will not be published.