[CentOS] apache redirection

Wed May 19 20:13:52 UTC 2010
Craig White <craigwhite at azapple.com>

On Wed, 2010-05-19 at 14:08 -0600, Ski Dawg wrote:
> Hello everyone,
> 
> Part of our website has secured access with an SSL certificate. The
> problem we are running into is that the certificate is for
> www.domainname.com, so when they go to domainname.com (without the
> www. in front), the users are getting a "This connection is untrusted"
> warning, because the url doesn't match the certificate.
> 
> I found one site that said to make a change to the apache conf file,
> which I have done. The change that I made is adding:
> <VirtualHost xxx.xxx.xxx.xxx:80>
>     ServerName domainname.com
>     Redirect permanent / http://www.domainname.com/
> </VirtualHost>
> 
> This works great to redirect the users to http://www.domainname.com
> when they go to http://domainname.com.
> 
> The problem I am running into is if they go to https://domainname.com
> (straight to the secure site), I am not able to find a solution that
> will redirect them to https://www.domainname.com, so that the ssl
> certificate matches and they won't get the "This connection is
> untrusted" warning.
> 
> I tried using the same thing as above, but changing the port number to
> 443, and the http to https on the redirect line, but that actually
> breaks the site, and only displays an error:
> Secure Connection Failed
> (Error code: ssl_error_rx_record_too_long)
> 
> Is there something obvious that I am missing? Is there a better way to
> ensure that everyone will always end up with the www in the url, so
> the certificate always matches?
----
yes, put the same VirtualHost directive into /etc/httpd/conf.d/ssl.conf

Craig


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.