0

I am redirecting https://username.mywebsite.com/ to https://mywebsite.com/username using this redirection

RewriteEngine On

RewriteCond %{HTTP_HOST} ^(.*).mywebsite.com [NC]
RewriteRule .* https://mywebsite.com/%1

OR 

RewriteCond %{HTTP_HOST}  ^([^.]+)\.mywebsite\.com
RewriteRule ^(.*)$ https://mywebsite.com/%1 [L,NC,QSA,R]

But I get this error when I try my page using subdoamin:

There is a problem with this website’s security certificate.

The security certificate presented by this website was issued for a different website's address.

Security certificate problems may indicate an attempt to trick you or intercept any data you send to the server.

We recommend that you close this webpage and do not continue to this website.

Recommended iconClick here to close this webpage.

Not recommended iconContinue to this website (not recommended).

I can click "Continue to this website (not recommended). " and my browser ignore the error but this is not user friendly.

I have unlimited users and my SSL is wildcard . I don't want users get this error :(

I have added *.mywebsite.com to the routing

Here is may ssl config

<VirtualHost *:443>
        ServerName mywebsite.com
        ServerAdmin webmaster@mywebsite.com

        DocumentRoot /var/www/html/mywebsite.com

        RewriteEngine on

        SSLEngine on
        #SSLProxyEngine on

        SSLCertificateFile /etc/apache2/ssl/markethive.com/mywebsite.crt
        SSLCertificateKeyFile /etc/apache2/ssl/markethive.com/mywebsite.key
        SSLCACertificateFile  /etc/apache2/ssl/markethive.com/mywebsite.ca-bundle

        LogLevel info
        ErrorLog /var/log/apache2/markethive.com_ssl/error.log
        CustomLog /var/log/apache2/markethive.com_ssl/ssl.log  combined
</VirtualHost>

Any help please.

Fury
  • 139
  • 1
  • 1
  • 9

1 Answers1

1

This mean your SSL certificate is not a valide certificate (may be you self signed it ?).

  • To obtain a SSL certificate you have to find a SSL provider and get your certificate & Key from them. It will cost you money to buy a SSL certificate.

  • You need a certificate for each subdomain too.

  • If you have an official certificate, try to correct the time on your client computer.

  • Check your SSL configuration, it is maybe not correct

  • If you are using a wildcard SSL, you need to set your certifiate to default to be able to set it for each SSL site :


<VirtualHost _default_:443> 
..
SSLCertificateFile /etc/apache2/ssl/markethive.com/mywebsite_com.crt 
SSLCertificateKeyFile /etc/apache2/ssl/markethive.com/mywebsite_com.key 
SSLCACertificateFile /etc/apache2/ssl/markethive.com/mywebsite_com.ca-bundle
...
</VirtualHost>

<VirtualHost *:443>
...
#your server conf
...
</VirtualHost>
Fury
  • 139
  • 1
  • 1
  • 9
Froggiz
  • 3,043
  • 1
  • 19
  • 30