tags:

views:

35

answers:

2

How can I force https for *.example.com?

I have tried:

RewriteCond %{HTTPS} !=on
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [R,L]
A: 

I think you will find an answer there: http://www.askapache.com/htaccess/apache-ssl-in-htaccess-examples.html

GôTô
A: 

Make sure you have mod_rewrite install and this should work for you:

RewriteEngine On 
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]

If you wanted to do it for certain sub domains:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(sub1|sub2|sub3)\. [NC]
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
Stephen Holiday