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

Server connection timed out - Unable to access website and cPanel

I tried accessing the website and cPanel from my system (local network) but I was getting error...

How to enable Open SSL on WHM?

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

Fatal error: Call to undefined function utf8_substr()

While accessing Opencart site, I was getting error as 'Fatal error: Call to undefined function...

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 allow remote MySql connection to only one IP?

There may be a case in which one of the cPanel user request you to provide access to Mysql...

Powered by WHMCompleteSolution