apache2 - VirtualHost redirect https://www.example.com to https://example.com not working - Ask Ubuntu


i'm running several different virtual hosts on apache2. each has own .conf file. i'm trying redirect traffic https://example.com have certificates. https://example.com, http://example.com, , http://www.example.com work fine. however, https://www.example.com not working correctly. here .conf layout:

<virtualhost *:443> servername example.com ... (server/ssl configuration) </virtualhost>  <virtualhost *:443> servername www.example.com redirect permanent / https://example.com/ </virtualhost>  <virtualhost *:80> servername example.com redirect permanent / https://example.com/ </virtualhost>  <virtualhost *:80> servername www.example.com redirect permanent / https://example.com/ </virtualhost> 

what missing?

i think it's not possible, if don't have correct certificate https://www.example.com. in (ssl) process of client-server handshake, establishment of secure connection first step.

if have certificate https://www.example.com add .conf file:

<ifmodule mod_ssl.c>     <virtualhost _default_:443>         servername www.example.com          redirect permanent / https://example.com         sslengine on         sslcertificatefile /etc/ssl/certs/www.example.com.crt         sslcertificatekeyfile /etc/ssl/private/www.example.com.key         sslcertificatechainfile /etc/ssl/certs/www.example.com.root-bundle.crt     </virtualhost> </ifmodule> 

Comments

Popular posts from this blog

download - Firefox cannot save files (most of the time), how to solve? - Super User

windows - "-2146893807 NTE_NOT_FOUND" when repair certificate store - Super User