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

Danny Blaise from Malaysia:
 I am very satisfied with the services and responses that I get from all of the EGN team. They never stop helping me although I always ask them questions almost everyday. Can you imagine how irritating it is if the support team of other site get me as their client. But EGN is different because customer is always first to them and they give highly motivated support to me. Thank you EGN Team Regards, Danny Blaise 

Latest News

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   
May 15, 2025:
 We are very happy to inform you about the new release of egSuperBusiness + Shop. The current version is 2.1 and egSuperBusiness + Shop is getting better with many improvement and new features such as: Now working with PHP 8.2 35 payment plugins, now supporting Bitcoin/Crypto payments, Metamask, Banks, Credit cards, mobile wallet and many more New method of withdrawal request to add more security Instant payment of withdrawal request using Metamask New Template: "member-only" - To have egSuperBusiness + Shop as Members Area only and install WordPress as the frontpage features and content. Improvement with design of Admin & Members dashboard, Frontpage and Advertisements areas Improvement with Member's nerwork and Genealogy Trees Improvement with TinyMCE content editor Improvement with Admin & Member dasboard security Improvement with Templating system Update javascripts to the latest & stable version. Improvements with payment logs in Admin area Improvement with function of Online Shop, Downloads and Articles Updating PHP Cores to the latest version available And many other improvements and fixes, please visit demo website to see more... D... 

Accepted Payments