As the question states, I want to redirect http://example to http://www.example.com AND https://example.com to https://www.example.com.

I tried the apache re-write rules:

RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

#jmv-this should work, but does not
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

but only http://example.com gets redirected to http://www.example.com. When I go to https://example.com I stay at https://example.com

I think these rules should work. What's the problem?

link|improve this question
Where are those rules configured? – Shane Madden Sep 14 '11 at 19:23
.htaccess file. It is the standard .htaccess that comes with a drupal install. – jmvidal Sep 14 '11 at 19:26
Is there anything substantively different about the :443 VirtualHost block from the port 80 one? Specifically, an AllowOverride? – Shane Madden Sep 14 '11 at 19:33
Ahhh, that was it! Put it in an answer and I'll mark it. Thanks! – jmvidal Sep 14 '11 at 19:43
feedback

1 Answer

up vote 1 down vote accepted

AllowOverride elsewhere in the configuration can inadvertently disable the use of .htaccess files - which seems to have been the case here!

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.