VirtualHost https redirect issue

Posted February 23, 2018 1.5k views

I was following the guide on and it works up to the point where I can get SSL working if I actively go to https, but anyone who goes to http is stuck there.

I’ve tried:

redirect rules
RedirectMatch permanent /(.*)$1
Adding those same things to 443

I’ve checked other threads like and I think I’m officially out of answers.

<VirtualHost *:80>
    Redirect /

<VirtualHost *:443>

        DocumentRoot /var/www/sales/sales-git
        CustomLog /var/www/sales/logs/access_log combined
        ErrorLog /var/www/sales/logs/error.log

        SSLEngine On
        SSLCertificateFile /home/user/
        SSLcertificateKeyFile /home/user/
        SSLCertificateChainFile /home/user/intermediate.crt

        <Directory "/var/www/sales/sales-git/">
                Options -Indexes +FollowSymLinks
                AllowOverride All
                Order allow,deny
                Allow from all

        SetEnvIfNoCase Host ^$ ok
        SetEnvIfNoCase Host ^$ ok
        SetEnvIfNoCase Host ^$ ok

        <Location />
                Order Deny,Allow
                Deny from all
                Allow from env=ok

Any help is welcome!!!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers

Turns out that there was an .htaccess I couldn’t see mucking everything up. Applied a forwarding rule there and it worked out just fine.

Can you try adding the line return 301 https://$host$request_uri; to your VirtualHost and remove all the other HTTPS redirect information?