How to force the site to use https using .htaccess file?

If you've working SSL certificate on your website and you'd like force your website to load using 'https' in web-browser then feel free to add the below code in '.htaccess' file under root directory-

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

Let me know your thoughts on it!
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to Install or Uninstall EasyApache 4 on cPanel server?

EasyApache Software is included within your cPanel and WHM license which is very easy and useful...

How to enable Hot Link Protection in cPanel?

To avoid other sites to use your website's bandwidth, you can enable the hot link protection....

Failed to send your message. Please try later or contact the administrator by another method - WordPress Contact Form is not working

While sending email from WordPress's contact form, I was getting below error -Failed to send your...

How to Specify the exact time to run a backup on cPanel server?

How to Specify the exact time (hour) to run a backup on cPanel server? Solution :- By default,...

How to backup single MySQL table?

Backup single MySQL table using shell command and phpMyAdmin 1. Creating dump file -...

Powered by WHMCompleteSolution