How To Ensure Your Visitors Use The Dedicated SSL

February 1, 2016 / SSL

When your visitors are submitting personal and sensitive information on your website. It is necessary to make them use an SSL-encrypted connection. An SSL-encrypted connection ensures that the sensitive data that is being submitted on a website goes through a secure encrypted route. That cannot be read by anyone except the party to which you are submitting the information. If you need help, use the SSL-encrypted connection that bodHOST offers to our shared hosting customers. Then please read our article on “forcing your visitors to use the shared SSL”.

To force your visitors to use a SSL you need to make some modifications to your .htaccess file using mod_rewrite.

To ensure all your website traffic uses HTTPS insert the following lines of code in the .htaccess file in your website’s root folder.

Important: If you have any existing code in your .hatches file. Add this code above that code where there are already rules with a similar starting prefix.

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

Make sure to replace www.yourdomain.com with your actual domain name.

To ensure a specific domain uses HTTPS. enter 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.yourdomain.com/$1 [R,L]

In the code above, make sure you replace example\.com with the domain name. You are trying to force to use HTTPS. You also need to replace www.yourdomain.com with your actual domain name.

If you want to force visitors to use SSL encryption on a specific folder. Then simply 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.yourdomain.com/folder/$1 [R,L]

In the above code make sure you change the folder reference to the actual folder name. Then make sure to replace www.yourdomain.com/folder with your actual domain name. And the folder you want to establish the SSL on. If you need further help, please feel free to contact our support on our website.