Skip to main content

Posts

Showing posts with the label How to force HTTPS using .htaccess file in cPanel

How to force HTTPS using .htaccess file in cPanel

Create .htaccess file on root and type below code METHOD 1: RewriteCond %{HTTPS} !=on # This checks to make sure the connection is not already HTTPS RewriteRule ^/?(.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]          METHOD 2:        RewriteEngine On RewriteCond %{HTTP_HOST} ^example\.com [NC] RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]   Save and Upload .