Knowledgebase
Redirect HTTP to HTTPS
Posted by Ruthy S on 17 July 2017 07:09 PM

To force all web traffic to use HTTPS insert the following lines of code in the .htaccess file in your website’s root folder.

Important:If you have existing code in your .htaccess, add this above where there are already rules with a similar starting prefix.

RewriteEngine On

RewriteCond %{SERVER_PORT} 80

RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]

Be sure to replace www.example.com with your actual domain name.

To force a specific domain to use HTTPS, use the following lines of code in the .htaccess file in your website's root folder:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^example\.com [NC]

RewriteCond %{SERVER_PORT} 80

RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]

If you want to force SSL on a specific folder you can insert the code below into a .htaccess file placed in that specific folder:

RewriteEngine On

RewriteCond %{SERVER_PORT} 80

RewriteCond %{REQUEST_URI} folder

RewriteRule ^(.*)$ https://www.example.com/folder/$1 [R,L]

Make sure you change the folder reference to the actual folder name. Then be sure to replace www.example.com/folder with your actual domain name and folder you want to force the SSL on.

(0 vote(s))
Helpful
Not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
CAPTCHA Verification 
 
Please enter the text you see in the image into the textbox below (we use this to prevent automated submissions).

Home / Terms of Service / Privacy Policy

Copyrights © All Rights Reserved by A+ Hosting, Inc., DBA ServerPoint.com, proudly located in the great state

of Nevada, with data centers located around the globe. Deploy Linux and Windows virtual private servers, cloud

servers and cloud hosting in Amsterdam (Netherlands), Las Vegas (Nevada), Dallas (Texas ), Ashburn (Virginia), Santa Clara (Silicon Valley, California) and Singapore.

Help Desk Software by Kayako