How To Force HTTPS On My Website

Nov 4, 2024 - 18:41
Nov 4, 2024 - 18:47
 0  3
How To Force HTTPS On My Website

How To Force HTTPS On Any Website??

Step 1.
Create/Find .htaccess For Your Website In File Manager.

Step 2.

Select It And Click On Edit.

Step 3.

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


Copy And Paste This Code Given Above.

Explanation of the Rules:

  • RewriteEngine On: This enables the Apache mod_rewrite module.
  • RewriteCond %{HTTPS} off: This condition checks if the HTTPS protocol is off (i.e., the request is not secure).
  • RewriteRule: Redirects all requests to the HTTPS version of the same URL. The L flag stops any further rules from being processed, and R=301 indicates a permanent redirect.

What's Your Reaction?

like

dislike

love

funny

angry

sad

wow