Keywords: LAMP/MAMP/WAMP - Other - How to - Secure Connections (SSL/HTTPS)
Description:
i have Linux Redhat 7.6 with Apache 2.4,
Hello, I have a problem with some redirects from port 80 to port 443 with SSL certificate I want when someone enters my domain http:// domain2 to be redirected to https:// domain1
The problem is that when you enter http://domain2 I send it to https:// domain2 and I have a certificate error, since the only domain with SSL is domain1
My vhost configuration.
<VirtualHost *:80>
# General
ServerName domain1
ServerAlias domain2
RewriteEngine On
Redirect permanent / http ://www.domain1.com
ErrorLog /var/log/httpd24/error_log
CustomLog /var/log/httpd24/access_log combined
<Directory /var/www/html/domain1.com>
Options -Indexes
AllowOverride All
</Directory>
</VirtualHost>
<VirtualHost *:443>
# General
DocumentRoot /var/www/html/domain1.com
ServerName domain1
ServerAlias domain2
# Logging
ErrorLog /var/log/httpd24/error_log
CustomLog /var/log/httpd24/access_log combined
SSLEngine on
#SSLProtocol all -SSLv2 -SSLv3
<Directory /var/www/html/domain1.com>
Options -Indexes
AllowOverride All
</Directory>
</VirtualHost>