Home / All Topics / General guides / Force HTTPS Redirection

Last updated 5 months ago

## Force HTTPS Redirection

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 ^(.*)$ https://www.example.com/$1 [R=301,L]
RewriteCond %{SERVER_PORT} 80

Note:- you must replace example.com 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

### Related articles

- How to change onlinetrader user dashboard
- What is a tradecopier and how does it work
- Onlinetrader education module and how it works