-1

If I go to example.com/index.php or www.example.com the site loads correctly. If I just go to http://example.com it redirects me to https://example.com which gives an invalid cert error, and brings me to what is supposed to be shown when going to mail.example.com

Here is my config:

Listen 80
<VirtualHost *:80>
ServerName example.com
DocumentRoot /var/www/c1/example/example.com
</VirtualHost>

<VirtualHost *:80>
ServerName www.example.com
DocumentRoot /var/www/c1/example/example.com
</VirtualHost>

<VirtualHost *:80>
ServerName pass.example.com
DocumentRoot /var/www/c1/example/pass.example.com
</VirtualHost>

<VirtualHost *:80>
ServerName ticket.example.com
ProxyRequests Off
    <Proxy *>
    Require all granted
    </Proxy>
ProxyPass / ajp://127.0.0.1:8009/
ProxyPassReverse / ajp://127.0.0.1:8009/
</VirtualHost>

Listen 443
<VirtualHost *:80>
ServerName mail.example.com
Redirect / https://mail.example.com
</VirtualHost>

<VirtualHost *:443>
ServerName mail.example.com
ServerAlias mail.example.com
DocumentRoot /var/www/c1/example/mail.example.com

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

SSLEngine on

SSLCertificateFile /home/user/SSL/mail.example.com.crt
SSLCertificateKeyFile /home/user/SSL/mail.example.com.key
SSLCACertificateFile /home/user/SSL/intermediate.crt

</VirtualHost>
2
  • Do you have a .htaccess file in /var/www/c1/example/example.com?
    – HBruijn
    Commented Apr 21, 2017 at 12:56
  • No .htaccess file. Commented Apr 21, 2017 at 13:05

1 Answer 1

0

Are you using Google Chrome to test? I've noticed that Chrome likes to redirect you to https on it's own. Make a cross check with another browser (IE / Firefox / etc.)

Also I don't see a https configuration for example.com or www.example.com which might also be an issue.

And if you don't want two entries for example.com you can use

<VirtualHost *:80>
    ServerName example.com
    ServerAlias www.example.com
    DocumentRoot /var/www/c1/example/example.com
</VirtualHost>
1
  • I don't want https for example.com or www.example.com (www.example.com works) I'm using firefox. It works on chrome. Lol this might be a browser cache issue. Commented Apr 21, 2017 at 13:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .