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!

Was this answer helpful?

 Print this Article

Also Read

Fatal error: Class 'JCache' not found in /libraries/joomla/factory.php - Joomla Issue

After updating the Joomla, I was getting Fatal error: Class 'JCache' not found in...

How to enable Open SSL on WHM?

Before enabling open SSL, you can check whether it is already enabled on your server. Please fire...

The MySQL server is currently offline. Mysql::initcache() failed: The mysql server is offline.

I was getting below error while accessing MySQL Databases from cPanel though MySQL service was...

How to get backup data recursively from the Amazon server?

There may be a situation where you do not have a zip utility on Amazon server so, the backup...

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...

Powered by WHMCompleteSolution