VirtualHost redirect https://www.example.com to https://example.com not working
Sophia Terry
I'm running several different Virtual hosts on Apache2. Each has its own .conf file. I'm trying to redirect all traffic to as that is where I have my certificates. , , and all work fine. However, is not working correctly. Here is my .conf layout:
<VirtualHost *:443>
ServerName example.com
... (server/ssl configuration)
</VirtualHost>
<VirtualHost *:443>
ServerName
Redirect permanent /
</VirtualHost>
<VirtualHost *:80>
ServerName example.com
Redirect permanent /
</VirtualHost>
<VirtualHost *:80>
ServerName
Redirect permanent /
</VirtualHost>What am I missing?
31 Answer
I think it's not possible, if you don't have a correct certificate for . In the (ssl) process of client-server handshake, establishment of secure connection is the first step.
If you have certificate for add it to the .conf file:
<IfModule mod_ssl.c> <VirtualHost _default_:443> ServerName Redirect permanent "/" "" SSLEngine on SSLCertificateFile /etc/ssl/certs/ SSLCertificateKeyFile /etc/ssl/private/ SSLCertificateChainFile /etc/ssl/certs/ </VirtualHost>
</IfModule> 4