Search The Hostwinds Guides Knowledge Base

Redirect to Use the SSL Connection (https)

Share This Article [TheChamp-Sharing]

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 to use your SSL connection. If you have not created an .htaccess file or you’re 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]

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

Related Articles