Skip to main content

WordPress – Redirect HTTP to HTTPS

Submitted by admin on Thu, 12/16/2021 - 10:22

In this WordPress tutorial we will learn how to redirect a WordPress powered website from HTTP to HTTPS. This means all pages of the wordpress website will open with https protocol.


Step 1: Install SSL Certificate

Your first step should be to install a valid SSL certificate on your website. You do not need to purchase any SSL certificate. Your hosting provider should provide you free SSL certificate and should also install on your domain name.

In case, your hosting provider is not providing you SSL certificate, you can get a free Letsencrypt SSL cerficate for your website from here.

Step 2: Change Website Address

Login to your WordPress website and navigate to:
Dashboard arrow Settings arrow General

Add https to WordPress Address (URL) and Site Address (URL) as shown in below image.

Step 3: Add Redirect Code

Now we will redirect all non-https urls to https url.
Add following codes in .htaccess file located in public_html directory or in the WordPress root directory. These codes should be placed at the top.

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Your WordPress website should now use https protocol for all pages.

Alternative Method: Using A Plugin

You can also use a WordPress plugin to redirect your website to https.
Really Simple SSL

Please note, this plugin will only redirect your website to https, it will not get you a SSL certificate, nor will install SSL certificate on your domain name.

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.