Redirect http to https using htaccess in WordPress

Sharing is caring!

Redirecting HTTP to HTTPS is indeed important these days. As more and more work has relied upon the internet, the more we share our private information on the internet i.e. credit card number and bank details, user details, etc

Undoubtedly, the internet has revolutionized all the tasks and makes them more convenient to do. All the transactions are done in a few clicks and you don’t need to go out on the street for shopping or for any other task that is possible through the internet.

Internet is the storehouse of all of the sensitive information of users across the globe. But, is our data safe?

Unfortunately, HTTP is not fully secure.  Especially for websites where we need to secure our sensitive information like credit card, debit card and other bank details. So, to protect our data from malicious attacks, HTTPS was created.

Let me give an insight about HTTPS and how it works with SSL through this step-by-step guide on how you can move your website from HTTP to HTTPS.

Redirecting HTTP to HTTPS is indeed important these days. As more and more work has relied upon the internet, the more we share our private information on the internet i.e. credit card number and bank details, user details, etc

Undoubtedly, the internet has revolutionized all the tasks and makes them more convenient to do. All the transactions are done in a few clicks and you don’t need to go out on the street for shopping or for any other task that is possible through the internet.

Internet is the storehouse of all of the sensitive information of users across the globe. But, is our data safe?

Unfortunately, HTTP is not fully secure.  Especially for websites where we need to secure our sensitive information like credit card, debit card and other bank details. So, to protect our data from malicious attacks, HTTPS was created.

Let me give an insight about HTTPS and how it works with SSL through this step-by-step guide on how you can move your website from HTTP to HTTPS.

What is HTTPs?

move http to https in worddpress

Hypertext Transfer Protocol Secure (HTTPS) is an extension of the Hypertext Transfer Protocol. You may have seen it written in the URL of most sites that start with https:// instead of the familiar http://. 

It is encrypted to secure the transfer of data on the internet.

It adds security layer over the unsecured HTTP protocol to secure data such as billing details, credit card transactions, user login, etc. Thus, HTTPS prevents hackers from reading the data during the transfer of information between server and web browser.

HTTPS creates an encrypted link between the browser and the web server using the Secure Socket Layer (SSL).

Encryption is the process of converting text information with random numbers and letters that are impossible to understand by humans.

Why do you need HTTPS and SSL?

what-is-https

Google mark all the websites without SSL certificate and HTTPS as insecure.

Each Site has given a unique SSL certificate to identify user identification. If the server is faking to be on HTTPS, many modern browsers give them warning not to enter those sites.

Moreover, it has been observed that SSL also improves website SEO and enhance website ranking.

Website without HTTPS put bad impression on the users. So, it is mandatory to move from HTTP to HTPPS and install SSL to create a more credible image of your website.

Many payment companies like PayPal Pro, Authorize.net, etc only accept a secure connection before accepting payments.

Requirements of using HTTPS

HTTPS is not possible without SSL certificate. So, the first step is to purchase SSL certificate. There are multiple ways of purchasing SSL certificate. Also, there are various types of SSL Certificates available.

You can buy SSL certificate from these websites:

Once you purchase an SSL certificate, the next step is to install it. If you find it complicated to install by yourself, you can ask your hosting provider to install it for you.

Redirecting http to https Using htaccess file

After successful installation of SSL certificate, you need to redirect HTTP to HTTPS.

Now let’s begin.

Step1: Create Backup for website
The first step is to create a backup for your website. This will help you to restore all the data if you face any issue after making some changes.

You can find some free WordPress backup plugins such as Updraft, BackWPup, etc that are fairly good like the paid plugins.

Step2: Update Site Address
Go to Settings >> General from your WordPress dashboard. You will find WordPress Address and Site Address. Change http to https by simply editing it and the click on Save button.

redirect-website-to-https-wordpress-change-wordpress-settings

Step3: Add Https to admin area or Login pages
Open wp-config.php in hosting file manager and then add this code to this file.
define('FORCE_SSL_ADMIN', true);

Step4: Implement 301 redirect (It will redirect http URLs to https)
Open .htaccess file and add the code below.
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI}[L,R=301]

Step5: Fix mixed content

website-ssl-content-issue

After shifting from http to https, some of the images or links may left unchanged. To fix this problem, you can use plugins like better search replace or velvet blues update URLS.

move-http-to-https

Follow these simple steps to replace the data with https.

  • Open WordPress Dashboard.
  • Click on Tools
  • Add the link in “Search for”, which you want to replace with https.
  • Add https in “Replace with” option

Step6: Test SSL of go live
The last step is submitting a website to Google so that it will index your website pages with SSL. You can Check SSL using this website:  https://www.jitbit.com/sslcheck/

Sharing is caring!

Rishab Kapoor on FacebookRishab Kapoor on LinkedinRishab Kapoor on TwitterRishab Kapoor on Youtube
Rishab Kapoor
A Blog writer, a Web developer and a passionate teacher. Teaching on YouTube from last 7 years. Like to write articles about Web designing, Web development, Digital Marketing, and Online money making techniques. If you have any question about Web technologies and your career then you can contact me via above my social media profiles.