http -->https RedirectMatch problems

Hi all, im trying to forward a http request to an https.  I've tried multiple configurations ive found online and only one example actually forwarded my request but wrecked my other virtual hosts in the process.

Ill explain my setup.

apache2.2 on 2003 server.
I have 10 virtualhosts in httpd.conf.
one of those virtual hosts has ssl.  That would be my shopping cart www.cart.com.  The other virtual hosts are all domains using RedirectMatch to pass to a specific pages within www.cart.com.  for example virtual host www.house.com points to https://www.cart.com/house/

here is my main vhost that is ssl.  i need this exact configuration but redirecting to https.
NameVirtualHost 1.2.3.4
<VirtualHost cart.com>
      ServerName www.cart.com      
      ServerAlias cart.com
      ServerAdmin webmaster@cart.com
      DocumentRoot "D:/apache/htdocs/cart"
      ErrorLog logs/cart.com-error_log
      CustomLog logs/cart.com-access_log common
      SSLEngine On
      SSLCertificateFile conf/ssl/cart.crt
      SSLCertificateKeyFile conf/ssl/cart.key
                SSLCACertificateFile conf/ssl/intermediate.crt
    <Directory "D:/apache/htdocs/cart">
        AllowOverride All
    </Directory>
</VirtualHost>

the below vhosts worked for making http and https work but what ended up happening when i went to www.house.com it did a RedirectMatch to http://www.cart.com/house when it should have been https://www.cart.com/house

NameVirtualHost 1.2.3.4
<VirtualHost cart.com:80>
      ServerName www.cart.com      
      ServerAlias cart.com
      ServerAdmin webmaster@cart.com
      DocumentRoot "D:/apache/htdocs/cart"
      ErrorLog logs/cart.com-error_log
      CustomLog logs/cart.com-access_log common
    <Directory "D:/apache/htdocs/cart">
        AllowOverride All
    </Directory>
</VirtualHost>


NameVirtualHost 1.2.3.4
<VirtualHost cart.com:443>
      ServerName www.cart.com      
      ServerAlias cart.com
      ServerAdmin webmaster@cart.com
      DocumentRoot "D:/apache/htdocs/cart"
      ErrorLog logs/cart.com-error_log
      CustomLog logs/cart.com-access_log common
      SSLEngine On
      SSLCertificateFile conf/ssl/cart.crt
      SSLCertificateKeyFile conf/ssl/cart.key
                SSLCACertificateFile conf/ssl/intermediate.crt
    <Directory "D:/apache/htdocs/cart">
        AllowOverride All
    </Directory>
</VirtualHost>

<VirtualHost 1.2.3.4.5>
      ServerName house.com      
      ServerAlias house.com
      ServerAdmin webmaster@house.com
      DocumentRoot "D:/apache/htdocs/cart/house/"
      ErrorLog logs/cart.com-error_log
      CustomLog logs/cart.com-access_log common
        RedirectMatch ^/$ https://www.cart.com/house?1234
    <Directory "D:/apache/htdocs/cart/house">
        AllowOverride All
    </Directory>
</VirtualHost>
domoaarongatoAsked:
Who is Participating?
 
giltjrConnect With a Mentor Commented:
I would suggest that instead of doing the redirect in the virutal host defintion that you do it in .htaccess file.

This way the redirect is done after virtual host processing as been looked at.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.