https://panelsecure.com/kb/48/

Force HTTPS Connection using .htaccess


Sometimes you may need to make sure that the user is browsing your site over secure connection. An easy way to always redirect the user to secure connection (https://) can be accomplished with a .htaccess file inside the public_html folder, containing the following lines:

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


Please, note that the .htaccess should be located in the web site main (public_html) folder.

In case you wish to force HTTPS for a particular folder you can use:

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


The .htaccess file should be placed in the folder where you need to force HTTPS.

 


  • 1099 Users Found This Useful
這篇文章有幫助嗎?

Related Articles

Verifying if SSL Certificate has been Installed Correctly

SSL (Secure Socket Layer) is a critical component of sites that need to handle sensitive or...

Why is my SSL web page insecure? I see HTTPS Warnings!

Do you want to know why your secure page is not fully secure? If you feel your website is not...

Why is the SSL Certificate valid only for 90 days?

We use "Let’s Encrypt" and "cPanel Comodo" SSL Certificate providers that instantly issue SSL to...

How to activate SSL Certificate on my Domain Name?

To activate your Free SSL Certificate, please make sure that you have updated the PanelSecure...

Powered by WHMCompleteSolution