
After reading this post you will learn the free the easiest ways to move your WordPress site from HTTP to HTTPS in less than 5 minutes without spending a penny, this will not be a weak or positive SSL that some panel offers for free. It is the best you can get and among the most secure on the web.
Google made it clear in 2014 that sites with HTTPS will have better search privilege over a site with just HTTP read it here.
Most webmasters, especially bloggers, took Google’s statement as a joke, but today we can experience a significant difference between HTTP and HTTPS in terms of Google’s search results.
For most bloggers, most especially new bloggers, one of the best ways to improve their SEO is to migrate their blog from HTTP to HTTPS, and this has proven to be very positive. It is very easy to migrate.
HTTPS does not just give your website a better search reputation, it also keeps your site content and users’ info more secure, as it makes it very difficult for hackers to gain access to.
If you have an eCommerce or any other kind of site where users make purchases by using their credit card details, you must run such site on HTTPS; this will prevent third-party hackers as well as scammers to gain access to your customers’ information.
Congratulations if you are running your eCommerce with WordPress, this step will also work perfectly for you – keeping your online store secured as well as boosting your customer’s confidence while shopping on your site.
Without saying so much about to importance of HTTPS, let’s learn how to move our WordPress blog from HTTP to HTTPS for free.
How to Migrate WordPress from HTTP to HTTPS for Free
Before doing this, you will need first to have the Cloudflare free flexible SSL. This means that you will first connect your WordPress site to Cloudflare.
Step 1
Secure Your Admin Dashboard
To secure your admin dashboard go to your Control Panel click on File Manager
Next
Open your website location by clicking on public_html search for wp-config.php file and add the code below to your public_html script
define('FORCE_SSL_ADMIN', true);
Step 2
Use relative URL’s
The relative URL’s around your contents will be a great way to avoid issues when moving your WordPress site from HTTP to HTTPS. Open your phpMyAdmin from your control panel
Next, click on your WordPress database inside the phpMyAdmin. On the top Tab, click on SQL. Take perfect note of the database prefix; it may be something like wp_.
Enter the SQL code below to make all your site images relative URLs.
Note: if your WordPress table prefix is not wp_ you will have to edit the code by changing wp_post to your-table-prefix_post this you will have to do in all scripts with table prefix during the process.
UPDATE wp_posts SET post_content = ( Replace (post_content, 'src="//', 'src="//') ) WHERE Instr(post_content, 'jpeg') > 0 OR Instr(post_content, 'jpg') > 0 OR Instr(post_content, 'gif') > 0 OR Instr(post_content, 'png') > 0;
You will also need to run this next code below just in case there are any URLs with single quotations for src files.
UPDATE wp_posts SET post_content = ( Replace (post_content, "src='//", "src='//") ) WHERE Instr(post_content, 'jpeg') > 0 OR Instr(post_content, 'jpg') > 0 OR Instr(post_content, 'gif') > 0 OR Instr(post_content, 'png') > 0;
Then finally enter this last code below to change iFrames to secure.
UPDATE wp_postmeta SET meta_value=(REPLACE (meta_value, 'iframe src="//','iframe src="//'));
Step 3
Set to HTTPS in General Settings
Log into your WordPress Admin dashboard and click on Settings in the menu on the right menu, select General and there change your site URL to your website in the two places to https://yourwebsite.com
Step 4
Change .htaccess file
In this final step, enter the code below at the top of your .htaccess file. This code if entered correctly will force your entire website to use https://
Note: the .htaccess file can be found in your cPanel file manager, if not visible then you will have to enable view dot file depending on your cPanel to make it visible.
# Force HTTPS RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
And that is it all; you have successfully moved your WordPress site from http://to https://
Conclusion
Everything explained here is working perfectly as at the time this post was published. Please note that we are not giving any guarantee, this is why you must back up your site before trying to implement it.
Notwithstanding, it is still best that you purchase a valid SSL. Some hosting companies Namecheap gives free positive SSL, and Bluehost gives free HTTPS features for WordPress. So do your research wisely.
RELATED ARTICLES