VirtualHost redirect https://www.example.com to https://example.com not working

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?

3

1 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

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like