Link to home
Start Free TrialLog in
Avatar of domoaarongato
domoaarongato

asked on

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>
ASKER CERTIFIED SOLUTION
Avatar of giltjr
giltjr
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial