Last updated 2 weeks ago

Force HTTPS Redirection

How to force HTTPS redirection on your onlinetrader website

Sometimes your website may not load through https:// even when SSL is installed and activated on your domain, this happens on some servers. To forcefully redirect your website HTTP to HTTPS;

Open the ".htaccess" file on the root directory and add the following code at the end:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$$1 [R=301,L]
RewriteCond %{SERVER_PORT} 80

Note:- you must replace with your site URL.

If the above does not work for you, kindly use the below code as alternative

RewriteEngine on # force ssl
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]

Note:- that this should be your first rewrite rule.

* I hope this Helps