Hostwinds Tutorials

Search results for:


Table of Contents


How to force your site to load with an SSL

Redirect to Use the SSL Connection (https)

Tags: htaccess,  SSL 

How to force your site to load with an SSL

Using an SSL to encrypt the connection to your site not only makes visitors feel more at ease but should also give you some peace of mind knowing that this encryption is in place. But how do you ensure that a visitor will always use the SSL connection for your site? The answer is by using a 301 redirect rule inside of your .htaccess file. This article will cover how to redirect all of your traffic to use your SSL connection. If you have not created an .htaccess file or are not certain how to edit your .htaccess file, please refer to our guide: Creating and editing an .htaccess file.

How to force your site to load with an SSL

If you're using an SSL and you'd like to force your site to always load with the SSL, add this code to your .htaccess:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Using this method should ensure that visitors to your site always access using the SSL connection.

Written by Michael Brower  /  June 22, 2017