RewriteEngine doesn't work with SSLEngine

Discussion in 'Apache' started by gopinath.3411, Nov 5, 2013.

  1. #1
    Hi recently I have migrated my application from http to https, I have added the SSL part to my apache web server on linux. The SSL is working fine. Every time I access my application I need to enter https which I dont want to do. So I tired to add the rewrite rule to the httpd.conf file. But it doesn't work, I have tried many ways but no use, did some R&D and what I have found is SSLEngine is blocking the RewriteEngine. When I comment SSLEngine the rewrite rule works perfect but the SSL is disabled. When I turn on SSLEngine the Rewrite rule doesn't work, Can any one help me please?

    This is the code from httpd.conf

    ##### Begin SSL Specific Configuration Options #####
    
    LoadModule ssl_module modules/mod_ssl.so
    
    SSLRandomSeed startup builtin
    SSLRandomSeed connect builtin
    SSLEngine On
    SSLPassPhraseDialog exec:/WebAppSA/apache/V2.2/http-home/pfi-8398S/ssl.txt
    SSLCertificateFile /WebAppSA/apache/V2.2/certificates/mysite.com.cert
    SSLCertificateKeyFile /WebAppSA/apache/V2.2/certificates/mysite.com.key
    SSLCertificateChainFile /WebAppSA/apache/V2.2/certificates/ESSL_Intermediate_Apache.crt
    SSLSessionCacheTimeout 1000
    <Directory "/WebAppSA/cgi-bin">
        SSLOptions +StdEnvVars
    </Directory>
    
    SetEnvIf User-Agent ".*MSIE.*" \
    nokeepalive ssl-unclean-shutdown \
    downgrade-1.0 force-response-1.0
    
    Include http-home/pfi-8398S/proxy_balancer.conf
    
    LoadModule rewrite_module modules/mod_rewrite.so
    
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
    
    
    Code (markup):

     
    Last edited: Nov 5, 2013
    gopinath.3411, Nov 5, 2013 IP