Website general: How to Force HTTPS using .htaccess

Search:
How to Force HTTPS using .htaccess

After installing an SSL certificate, your website is available over HTTP and HTTPS. However, it’s better to use only the latter because it encrypts and secures your website’s data. You can use the .htaccess file to force HTTPS connection to your website. This tutorial will show you how.

 

Forcing HTTPS on All Traffic

One of the many functions you can perform via .htaccess is the 301 redirects, which permanently redirects an old URL to a new one. You can activate the feature to force HTTPS on all incoming traffic by following these steps:

  1. Go to File Manager in your hosting panel and open .htaccess inside the public_html folder (If you can’t find the file, go to the  Settings on the upper right menu and tick the Show Hidden Files option to enable viewing)
  2. Insert the following lines of code:
        RewriteEngine On 
        RewriteCond %{HTTPS} off 
        RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    
  3. Save the changes.

 

IMPORTANT: Make sure that the line RewriteEngine On is not repeated twice. In case the line already exists, simply copy the rest of the code without it.

Congratulations! you have successfully edited your .htaccess file and redirected all HTTP traffic to HTTPS, the safe version of your website.

 

Other tutorials in Website general:

 

Popular Tutorials:


Testimonial

April 30, 2020
Renato from Australia:
 Hi there EGN Software, I have bought a couple of your products in the past, and currently the Viral Shop script. My experience has been very good support, and all questions answered as needed. In addition, the products seem to work very well. Have not noticed any problems. Lots of thought, and design went into this script, and its very feature packed. This does not happen fast, but takes a lot of hard work and effort to produce a good product. I would like to recommend EGN Software. I setup the Viral Shop script and its working fine, and this is a very good company to deal with, no problems with them. Due to my privacy I have not displayed my email address for public viewin... 

Latest News

October 17, 2025:
We are happy to announce you that the newest version of egMLM with Revenue Sharing is now available. The newest version is v1.4 and its comes with functions: New features of revenue sharing functions: Now working with 2 type of Revenue sharing type: "Investment" and "Revenue share" Improving PHP performance and efficiency Optimizing HTML and JavaScript/ jQuery performances Improving withdrawal request payment using Metamask to be automatic Improvement with page Testimonial at frontpage Improvement with Revenue sharing profit payment process Improvement with online store functions New function: Set default shipping address  Improvement with member's login session to have more secure properties Improvement with Investment / Revenue sharing profit calculator Added Multi language (Google translator) to Admin dashboard so Admin can switch to any language that supported Improvement with page Testimonial at frontpage Improvement with template files Improvement with Admin notifications in Admin dashboard And other improvements and fixes, please visit demo of egMLM + Revenue Sharing to see more Download your copyThe update is available to download in y... 
September 9, 2025:
egMember version 2.1 has been released. This release contain new features and improvements such as: Now working with PHP 8.2 Improvements with members login session Improvement string input and processing Improvement with member tags for editing mails and contents Improvement with Admin & Member dasboard security Improvement with Templating system Improvement with TinyMCE content editor Improvement with Payment automation process Improvement with members email verification process Improvement with Countries selection in General configuration Improvement with member list in Admin area Improvement Cron Tasks And other improvements and fixes, please visit demo of egMember to see more. Download your copyThe update is available to download in your account area and update instruction is available in product tutorials. Please log in to your account area to access them.   Best regards & Success Always!EGN Software - Your best partner to build your success online business!WhatsApp: +62811696965 | Skype: egnsoftware | Telegram: egnsoftware   
August 4, 2025:
We are happy to announce you that the newest version of egMLM is now available. The newest version is v2.4 and its comes with functions: Now working with PHP 8.2 Improvement with Clean URL functions Improvement string input and processing Improvement with online store checkout process Improvement with Rank rewards function & layout Improvement with Pool rewards function & layout Improvement with member tags for editing mails and contents Fix problem with email validation on new member registration Improvement with Admin & Member dasboard security Improvement with Templating system Improvement with Email sending And other improvements and fixes, please visit demo of egMLM to see more Download your copyThe update is available to download in your account area and update instruction is available in product tutorials. Please log in to your account area to access them.   Best regards, EGN Software - Your best partner to build your success online business   
July 28, 2025:
We are happy to announce you that the newest version of egMLM with Revenue Sharing is now available. The newest version is v1.3 and its comes with functions: Now working with PHP 8.2 Improvement with Clean URL functions Improvement string input and processing Improvement with reward points Improvement with Rank rewards function & layout Improvement with Pool rewards function & layout Improvement with online store checkout process Improvement with member tags for editing mails and contents Fix problem with email validation on new member registration Improvement with Admin & Member dasboard security Improvement with Templating system And other improvements and fixes, please visit demo of egMLM + Revenue Sharing to see more Download your copyThe update is available to download in your account area and update instruction is available in product tutorials. Please log in to your account area to access them.   Best regards, EGN Software - Your best partner to build your success online business   
July 22, 2025:
We are happy to announce you that the newest version of egMLM with Advertisements is now available. The new version is v.15 and its comes with functions: Now working with PHP 8.2 Fix problem with email validation on new member registration Improvement with new member Regular matrix placement Fix problem with Pool bonus distribution New improved Admin and members dashboard Added BNB Smart Chain Metamask Wallet so total 30 payment plugins now available Improvement with error reporting Security patches for members area and admin area Improvement with TinyMCE content editor Improvement with Rank reward and Pool rewards Improvement with error reporting And other improvements and fixes, please visit demo of egMLM + Advertisement to see more Download your copyThe update is available to download in your account area and update instruction is available in product tutorials. Please log in to your account area to access them.   Best regards, EGN Software   

Accepted Payments