How to force your website to load securely (HTTPS)

The following .htaccess codes below forces any HTTP request to HTTPS. For example, the code forces a request from http://example.com to load https://example.com. Please ensure you replace the domain name "example.com with your own domain name.

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]

NB1). Please read https://www.globalhosting247.com/knowledgebase/2012/How-to-Edit-htaccess-File-via-the-cPanel-Filemanager-.html to learn how to edit the .htaccess file.

2). Please also note that if .htaccess file already contains some default WordPress code or any other .htaccess code, enter the new htaccess code  above or below that code. Never enter the .htaccess code inside of the comment tags that start and end with or similar of:

# BEGIN WordPress
# END WordPress

Kindly submit a support ticket if  incase you need further help on this.

  • 1 Users Found This Useful
Was this answer helpful?

Related Articles

Analyze and optimize speed of your website with GTmetrix tool

Get the speed report of your website (like the screen shot below)  and suggestions on how to...

php error: Allowed memory size of x bytes exhausted

If you are getting an error like "Allowed memory size of... in file...

How to create a user-friendly URL using .htaccess?

If your website is using long URL like example.com/files/folder/sitemap.html, you can change it...

How to redirect a page to another page or website using .htaccess?

If a page on your website no longer exist and you want to redirect it to your new page or website...