put this into root of the domain into the .htaccess file RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteCond %{REMOTE_HOST} !^.*YOURDOMAIN\.com [NC] RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] Jobst On Wed, May 19, 2010 at 02:08:59PM -0600, Ski Dawg (centos at skidawg.org) 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? > > Any thoughts and suggestions would be greatly appreciated. > -- > Doug > > Registered Linux User #285548 (http://counter.li.org) > ---------------------------------------- > Never trust a computer you can't throw out a window. > -- Steve Wozniak > _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos -- I have a license to "kill -9"! | |0| | Jobst Schmalenbach, jobst at barrett.com.au, General Manager | | |0| Barrett Consulting Group P/L & The Meditation Room P/L |0|0|0| +61 3 9532 7677, POBox 277, Caulfield South, 3162, Australia