Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|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

1 Answer 1

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!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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