I have two domains : my-domain.com and my-domain.fr
I want to redirect traffic as followed :
- my-domain.com:80 -> my-domain.com:443
- my-domain.fr:80 -> my-domain.com:443
- my-domain.fr:443 -> my-domain.com:443
I've chosen to only use .com, am I right ? I guess yes. Because I only have to manage one certificate : the .COM one.
My /etc/apache2/sites-available/default :
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.my-domain.com
ServerAlias my-domain.com
Redirect permanent / https://www.my-domain.com
</VirtualHost>
<VirtualHost *:80>
ServerName www.my-domain.fr
ServerAlias my-domain.fr
Redirect permanent / https://www.my-domain.com
</VirtualHost>
My /etc/apache2/sites-available/default-ssl :
NameVirtualHost *:443
<VirtualHost *:443>
ServerName www.my-domain.com
ServerAlias my-domain.com
DocumentRoot /var/www/my-domain/
ErrorLog /var/log/my-domain/my-domain.com.error.log
CustomLog /var/log/my-domain/my-domain.com.access.log combined
GnuTLSEnable on
GnuTLSPriorities NORMAL
GnuTLSExportCertificates on
GnuTLSCertificateFile /etc/apache2/ssl/certs/my-domain.com.crt
GnuTLSKeyFile /etc/apache2/ssl/private/my-domain.com.key
</VirtualHost>
<VirtualHost *:443>
ServerName www.my-domain.fr
ServerAlias my-domain.fr
DocumentRoot /var/www/my-domain/
ErrorLog /var/log/my-domain/my-domain.fr.error.log
CustomLog /var/log/my-domain/my-domain.fr.access.log combined
GnuTLSEnable on
GnuTLSPriorities NORMAL
GnuTLSExportCertificates on
GnuTLSCertificateFile /etc/apache2/ssl/certs/my-domain.fr.crt
GnuTLSKeyFile /etc/apache2/ssl/private/my-domain.fr.key
</VirtualHost>
But I'm getting a SSL certificate error when I'm going to my-domain.fr because it tells me that I wanted to go on my-domain.fr and I'm not.