How to force visitors to use SSL

After installing your SSL certificate, you have the option to force all traffic to use https.

If you wish to switch manually between http and https, then you need to test the http status. The following examples show how to test for https or the lack of https.

RewriteCond %{HTTPS} on
RewriteCond %{HTTPS} !=on

For example, if you want to force all visitors to use https, you could use the following:

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R,L]
  • SSL Certificates
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to Password Protect a Directory

This tutorial will teach how to password protect a directory. Password protecting a directory...

How To Use The IP Deny Manager

This tutorial will teach you how to use the IP Deny Manager to block access to your web site from...

Using Hotlink Protection

Hotlink Protection prevents other web sites from directly linking to certain files (typically...