[CentOS] apache redirection

Barry Brimer lists at brimer.org
Fri May 21 23:00:59 UTC 2010


> On 21 May 2010 22:04, Ski Dawg <centos at skidawg.org> wrote:
>> On Wed, May 19, 2010 at 7:45 PM, Barry Brimer <lists at brimer.org> wrote:
>>> As for the redirection, I would handle it with mod_rewrite as follows:
>>>
>>> <VirtualHost XXX.XXX.XXX.XXX:443>
>>> ServerName domain.tld
>>> RewriteCond %{HTTP_HOST}   !^www\.domain\.tld$ [NC]
>>> RewriteCond %{HTTP_HOST}   !^$
>>> RewriteRule ^/(.*)         https://www.domain.tld/$1 [L,R=301]
>>> </VirtualHost>

> Those rewrite suggestions will not accomplish in solving the problem
> you presented....
>
> I wish people would actually read through the replies before
> suggesting something that has already been shown not to work ^^

James,

Perhaps you didn't notice the part in my message where I indicated that 
this would require separate IP addresses with appropriate certs on each, 
such as domain.tld and www.domain.tld.  My example does not include 
important things that are part of the configuration already to serve an 
https website with mod_rewrite support such as:

SSLEngine On 
SSLCertificateFile ... 
SSLCertificateKeyFile ...
RewriteEngine On
... etc

I am surprised to hear that this doesn't work since it works fine for me. 
What part do you feel doesn't work?

Barry


More information about the CentOS mailing list