Force SSL on Your Website Using .htaccess
Posted by on 27 October 2012 07:31 AM
Please note that you MUST have a SSL certificate and a Dedicated IP address to use SSL on your website and therefore be able to do a SSL redirect. Please contact our support at support@hostnine.com for more information on pricing and installation.

This guide assumes you can edit your .htaccess file within the File Manager or through a FTP client. If you are unable to locate any .htaccess files within your tool of choice, please create it. It is also worth noting that by default some of the available tools will not display the .htaccess files. If you would like to learn how to display .htaccess files in cPanel File Manager, please look into this article: How do I make my File Manager display .htaccess files?

Editing the .htaccess file

The .htaccess file you will be editing must be in the directory root for the domain. What you will be adding to the .htaccess file is really simple, you will just need to add it on the top of the file, before any other contents of the file.

Please add:

RewriteEngine On
RewriteCond %{HTTP_HOST} www\.example\.com
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]
Please replace www.example.com with your actual domain name that you are willing to force SSL on -- also, remember the backslashes before dots next to %{HTTP_HOST}!

After saving the file, visiting the website should be forcing SSL connections, please be advised that if your website pulls any kind of content through http, therefore not through the secure protocol, it will not work, as any content on a SSL secured site must be coming from secure (https) sources.

(1 vote(s))
This article was helpful
This article was not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
Help Desk Software by Kayako fusion