M
M
Macbet2018-12-07 01:25:23
Nginx
Macbet, 2018-12-07 01:25:23

Is it possible to redirect https from one domain to another https domain?

There is a problem, we have one example.com domain and the test.com
example.com domain should redirect to test.com ( test.com sits behind ssl)

server {
       listen 80;
       server_name example.com www.example.com;

       root /var/www/html;

        index index.html index.htm index.nginx-debian.html;

        location / {
               
                return 301 https://test.com/test-test;
        }
}

works great
server {

   server_name example.com www.example.com;

     rewrite ^/(.*)  https://test.com/test-test;

    listen 443 ssl http2; # managed by Certbot
    ssl_certificate /etc/le/example/fullchain.pem; 
    ssl_certificate_key /etc/le/example/privkey.pem; 
    include /etc/le/options-ssl-nginx.conf; 
    ssl_dhparam /etc/le/ssl-dhparams.pem; # 

}

it works as you understand too, but when you open the site, there is a warning that the domain is not safe, maybe the question is stupid, but is it possible to make this kind of redirect and that there would be no warnings ???
UPD. Everything was decided, I regenerated the certificates from www. subdomain and everything was fine

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mysterion, 2018-12-07
@Mysterion

is it possible to make this kind of redirect and that there would be no warnings

Yes, add SSL to the domain.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question