HTTP to HTTPS Redirect

Chrome and Firefox will show insecure warnings on your sites without SSL certificates. Without an SSL certificate, your website will show insecure to the visitors. If you do not install SSL certificate on your website, follow this tutorial:

How to install free SSL certificate on your website using Let’s Encrypt

Once the SSL certificate is installed, your site still remains accessible via a regular insecure HTTP connection. To connect securely, visitors must specify the https:// prefix manually when entering your site’s address in their browsers. If you want to force secure connection automatically, It is very important to redirect HTTP to HTTPS. This way, anyone visits your website using a link like “yourwebsite.com” will be automatically redirected to “https://yourwebsite.com” or “https://www.yourwebsite.com” making the traffic encrypted using SSL certificate.

WordPress HTTP to HTTPS redirect

If you are using WordPress CMS, You can easily redirect HTTP to HTTPS by installing Really Simple SSL plugin.

HTTP to HTTPS redirect

The plugin has 1 million+active installs with average 4.9 rating. You can download Really Simple SSL from the WordPress repository or by searching for it within your WordPress dashboard under “Add New” plugins.

WHAT DOES THE PLUGIN ACTUALLY DO

  • All incoming requests are redirected from HTTP to HTTPS. Default with php and javascript redirect or else with the .htaccess redirect.
  • The WordPress site URL and home URL are changed to https.
  • Your insecure content is fixed by replacing all HTTP:// URLs with HTTPS://, except links to other external domains. Everything is done dynamically. Other than the WordPress site URL and home URL, no other database changes are made.

 

It’s very easy to redirect from HTTP to HTTPS, you simply install and click on “Go ahead, activate SSL” and you’re good to go.

HTTP to HTTPS redirect using htaccess

You need to create a .htaccess file for the redirect from HTTP to HTTPS, and you can use your control panel’s File Manager or FTP.

If you have an existing .htaccess file:

  • Do not duplicate RewriteEngine On.
  • Make sure the lines beginning RewriteCond and RewriteRule immediately follow the already existing RewriteEngine On.

Redirect All Web Traffic

To automatically redirect all web traffic from HTTP to HTTPS add the following code in the .htaccess file:

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

 

Redirect Only a Specific Domain

For redirecting a specific domain to use HTTPS, add the following:

RewriteEngine On 
RewriteCond %{HTTP_HOST} ^yourdomain\.com [NC]
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R,L]

Note: Please replace “yourdomain” with your domain name wherever required. 

Redirect Only a Specific Folder

Redirecting to HTTPS on a specific folder, add the following:

RewriteEngine On 
RewriteCond %{SERVER_PORT} 80 
RewriteCond %{REQUEST_URI} folder 
RewriteRule ^(.*)$ https://www.yourdomain.com/folder/$1 [R,L]

Note: Please replace /folder with the actual folder name.

 

If you need any help, click here to contact me.

LEAVE A REPLY

Please enter your comment!
Please enter your name here