TransWikia.com

Certificate warning before URL Rewrite for Second domain in Apache 2.4

Server Fault Asked by ronypatil on January 15, 2021

I am receiving certificate warning on browser before redirecting second domain to page of first primary site domain. Redirect is working after If clicked on Advanced. Same happening with chrome and showing site is not secure. Certificate is not wild card.

Websites prove their identity via certificates. Firefox does not trust this site because it uses a certificate that is not valid for mysite2.ca. The certificate is only valid for the following names: mysite1.ca, www.mysite1.ca
code: SSL_ERROR_BAD_CERT_DOMAIN

May I know how can this certificate error can be resolved ? Here is my host file.

<VirtualHost mysite1.com:80>
  ServerName mysite1.com
  ServerAdmin [email protected]

  DocumentRoot /var/www/html/mysite1/public

  <Directory "/var/www/html/mysite1/public">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Allow from all
    Require all granted
    Order allow,deny
  </Directory>

  RewriteEngine On
 
  RewriteCond %{HTTPS} off
  RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [NE,R=301,L]
  RewriteRule ^(.*) https://%{HTTP_HOST}%{REQUEST_URI}

  LogLevel alert rewrite:trace3

  LogLevel debug
  ErrorLog /var/log/httpd/craft_error_log

</VirtualHost>

<VirtualHost mysite1.com:443>
  ServerName mysite1.com
  ServerAdmin [email protected]

  DocumentRoot /var/www/html/mysite1/public

  SSLEngine on
  SSLProtocol -all +TLSv1.2 +TLSv1.3

  SSLCertificateKeyFile "/usr/certs/mysite1.com.key"
  SSLCertificateChainFile "/usr/certs/mysite1.crt"
  SSLCertificateFile "/usr/certs/mysite1Certificate.crt"

  RewriteMap escape int:escape

  #Rewrite rule for mysite2.com domain

  RewriteEngine On

  RewriteCond %{HTTP_HOST} ^mysite2.com [NC,OR]
  RewriteCond %{HTTP_HOST} ^www.mysite2.com [NC]
  RewriteRule ^ https://mysite1.com/section/targetpage [L,R=301,NC]


  LogLevel alert rewrite:trace3
  <Directory "/var/www/html/mysite1/public">
     Options Indexes ExecCGI FollowSymLinks
     Order allow,deny
     Allow from all
     AllowOverride all
  </Directory>

</VirtualHost>

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP