Two ways to force SSL on your website
Submitted by linportal on Fri, 2007-04-20 01:47
Two solutions, both to be put in the .htaccess file, when you want to force your website visitors to go through SSL:
Solution A:
RewriteEngine On
RewriteCond %{SERVER_PORT} !443$
RewriteRule ^(.*)$ https://www.example.com/$1 [L,R]
Solution B:
RewriteEngine on
RewriteCond %{HTTPS} !^on$ [NC]
RewriteRule . https://%{HTTP_HOST}%{REQUEST_URI} [L]
Pick whatever solution looks nicer for you.
»
- linportal's blog
- Add new comment
- 15540 reads








Recent comments
1 week 4 days ago
1 week 4 days ago
2 weeks 10 hours ago
3 weeks 3 days ago
4 weeks 1 day ago
9 weeks 3 days ago
10 weeks 1 day ago
10 weeks 2 days ago
10 weeks 6 days ago
11 weeks 6 days ago