ID #352

How do I enforce the use of SSL on my website?

Applies to: Grid System

You may enforce the use of SSL on your site in part or full by using mod_rewrite. Simply create a file named '.htaccess' at the appropriate location where you would like to begin enforcing SSL -- eg. /htdocs/www/.htaccess to enforce SSL for anyone connecting to www.yourdomain.com/.

Include these lines in your .htaccess file:
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*)$ https://%{HTTP_HOST}/$1 [R]

Note: this may not react the way you'd like it to in all cases, eg. domain aliases. If it does not, please test it and tweak it to your specifications.

Last update: 2010-10-05 16:10
Author: FAQ Admin
Revision: 1.2

Digg it! Share on Facebook Print this record Send FAQ to a friend Show this as PDF file
Please rate this FAQ:

Average rating: 0 (0 Votes)

completely useless 1 2 3 4 5 most valuable

You can comment this FAQ