Webinoly is just the perfect tool for NGINX experts. Give it a try!
0 votes
by Rookie
While using domain forwarding for my website. I successfully redirected myolddomain.com to mynewdomain.com. But, my old domain possesses ssl certificate, I mean its normal path is https://www.myolddomain.com. The issue is that the domain forwarding only listens port 80 and not port 443. So, my http://www.myolddomain.com to https://www.newdomain.com is working fine. Whereas, my https://www.myolddomain.com to https://www.newdomain.com doesn't redirect it. It simply opens https://www.myolddomain.com.

Need help here on how to redirect https version to the new domain.
by Expert
To be honest, this is the first time I heard about this, eventhough I think it makes sense, I have also some doubts about how practical it can be. For example, the cert should be issued using the "manual" option, that means that everytime the cert needs to be renewed, you will need to do it manually, which can be very impractical in many cases.

Definitely, this is something I will think about and I appreciate if someone knows about a better workaround, let us know!
by Rookie

I figured out the issue. In order to redirect the https:// version of your website follow these steps.

First, grab the SSL for the old domain using 
sudo site myolddomain.com -root=mynewdomain.com -ssl=on

then head over to the configuration file of the myolddomain.com located at /etc/nginx/sites-available/myolddomain.com

You will find two server blocks in the file

1. with Port 80

2. other with Port 443

Simply paste this line after server myolddomain.com www.myolddomain.com under Port 443. (It will be already present under Port 80 server block.)

paste this - return 301 https://mynewdomain.com$request_uri;


by Rookie
Would this solution allow for an automatic renewal of the certificate? What about creating a simple html site "sudo site example.com -html" plus "sudo site example.com -ssl=on" and use a <meta> refresh tag?

About the need for ssl on "www.myolddomain.com", it would be required if HTTP Strict-Transport-Security was in use.
by Expert

I see a lot of issues with both solutions:

  • I'm sure there's something wrong in the configuration of the SSL requested using a different root, if you have properly configured the "domain forwarding", then the SSL can not be issued or renewed.
  • Using the "meta refresh" is not the most optimal solution, the redirection depends on the clients browser and I'm sure some SEO guys will not like this solution, in fact, it's considered a "bad practice".

1 Answer

0 votes
by Rookie

The right option would be to use the redirection manager and redirect from /. Right?

sudo site [site] -redirection
Welcome to the Community site for Webinoly.

Our Optimized LEMP Web Server is a powerful set of commands for doing just about anything you could wish.

With Webinoly you can set up your NGINX web server in just one step.

* * * * * * *

To report a bug, please create a new issue on GitHub or ask a question here with the bug tag.
Webinoly Support Paypal Donations

PayPal · GitHub Sponsors · Bitcoin

It is very important that any visitor to the site read the disclaimer, terms of use and privacy and legal statement before start browsing.