N
N
Nikolai Savelyev2018-02-11 16:00:23
linux
Nikolai Savelyev, 2018-02-11 16:00:23

How to redirect https traffic from a domain to another domain?

You need to redirect all traffic from one domain to another on the same server.
I do:

<VirtualHost *:80>
        ServerName old-site.ru
        Redirect / https://new-site.ru
</VirtualHost>

And all traffic is redirected to the right place.
I do:
<VirtualHost *:443>
ServerName old-site.ru
Redirect / https://new-site.ru
SSLCertificateFile /etc/letsencrypt/live/old-site.ru/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/old-site.ru/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateChainFile /etc/letsencrypt/live/old-site.ru/chain.pem
</VirtualHost>

And I get a certificate error. The old name is connected to the new certificate.
If you accept the certificate - opens a new site with the old name.
And I want the certificate not to swear and show the new name in the address bar!
Tried
RewriteEngine on
RewriteRule "^/?(.*)" "https://new-site.ru/$1" [R=301,L]

All the same. For some reason, the virtualhost of the new site over https intercepts all traffic.
But there is nothing like this:
<VirtualHost *:443>
DocumentRoot /var/www/
ServerName new-site.ru
SSLEngine on
SSLCertificateFile /etc/ssl/private/4650089.crt
SSLCertificateKeyFile /etc/ssl/private/4650089.key
SSLCertificateChainFile /etc/ssl/private/new-site.ca-bundle
</VirtualHost>


Where to dig?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikolai Savelyev, 2018-02-12
@nikweter

Added the NameVirtualHosts *:443 line to apache2.conf - it worked.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question