Unable to redirect http to https on Apache2 server

yo_bee used Ask the Experts™
How to redirect all http traffic to https on Ubuntu running Apache2.
Here is my sites conf file and I am not able to drive the traffic to https.

        ServerName OldDomian.com
        ServerAlias www.OldDomian.com
        Redirect /  https://www.NewDomain.com
       	ServerName NewDomain.com
        ServerAlias www.NewDomain.com
        Redirect /secure https://www.NewDomain.com

    ServerAdmin webmaster@localhost
    ServerName www.NewDomain.com
    ServerAlias NewDomain.com
    DocumentRoot /var/www/www.NewDomain.com/web
    SSLEngine on    
    SSLCertificateFile /etc/apache2/cert/359dc02304e01eae.crt    
    SSLCertificateKeyFile /etc/apache2/cert/hp.key
    #SSLCertificateFile /etc/apache2/cert/gd_bundle-g2-g1.crt
        Options FollowSymLinks
        AllowOverride All
    <DIRECTORY /var/www/www.NewDomain.com/web>
        Options +FollowSymLinks
        AllowOverride All
        #AuthType Basic
        #AuthName "Restricted Content"
        #AuthUserFile /etc/apache2/.htpasswd
        #Require valid-user

        # <IfModule mod_rewrite.c>
        # RewriteEngine On
        # RewriteBase /
        # RewriteCond %{REQUEST_FILENAME} -f [OR]
        # RewriteCond %{REQUEST_FILENAME} -d
        # RewriteRule ^.*$ - [S=40]
        # RewriteRule (.*)/(.*)/$ /index.php?page=$1&id=$2 [QSA,L]
        # RewriteRule (.*)/$ /index.php?page=$1 [QSA,L]
        # </IfModule>
        # php_value auto_prepend_file /var/www/www.NewDomain.com/prepend.php
    ErrorLog ${APACHE_LOG_DIR}/www.NewDomain.com_error.log
    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn
    CustomLog ${APACHE_LOG_DIR}/www.NewDomain.com_access.log combined

Open in new window

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Principal Software Engineer
Suggest having a look at the solution in the previous EE discussion linked below:

yo_beeDirector of Information Technology


Thanks for you help

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial