apache 2.4 redirect within virtualhost
        Posted  
        
            by 
                user129545
            
        on Server Fault
        
        See other posts from Server Fault
        
            or by user129545
        
        
        
        Published on 2012-08-06T17:18:08Z
        Indexed on 
            2014/06/12
            3:27 UTC
        
        
        Read the original article
        Hit count: 489
        
apache-2.4
I have a couple http (port 80) vhosts that I want to redirect to http if an https request is made to them. Apparently some things have changed with Apache 2.4 (NameVirtualHost not used like it was in the past, etc).
Apache 2.4 on centos 5.5, This is all using a single ip for all vhosts below, I don't have multiple ip's on this box,
my /usr/local/apache2/conf/extra/httpd-vhosts.conf :
#<VirtualHost www.dom1.com:80>
    ServerName www.dom1.com
    ServerAlias dom1.com
    DocumentRoot /usr/local/apache2/htdocs/dom1/wordpress
</VirtualHost>
<VirtualHost webmail.dom2.com:443>
    ServerName webmail.dom2.com
    DocumentRoot /usr/local/apache2/htdocs/webmail
    SSLEngine On
    SSLCertificateFile /usr/local/apache2/webmail.crt
    SSLCertificateKeyFile /usr/local/apache2/webmail.key
</VirtualHost>
my /usr/local/apache2/conf/extra/httpd-ssl.conf,
#Listen 443
SSLPassPhraseDialog  builtin
SSLSessionCache         shmcb:/var/cache/mod_ssl/scache(512000)
SSLSessionCacheTimeout  300
Mutex default
SSLRandomSeed startup file:/dev/urandom  512
SSLRandomSeed connect builtin
SSLCryptoDevice builtin
webmail.dom2.com works fine. Problem is I can connect to https://www.dom1.com, and it serves up the content from webmail.dom2.com. I want any https requests for www.dom1.com on port 443 to simply redirect to http://www.dom1.com on port 80.
Thanks
© Server Fault or respective owner