nginx redirection

The index page(hoo.gy) was initially rolled out in earlier days of the product to tell visitors what the product was all about. After the app matured enough, there were no reason to keep it there, with an overhead of maintenance on each release.

I therefore decided to make the redirection, with less changes on the architecture of the application. Running on nginx, I simply added rewrite as in following code:

    server{
        #more configurations are here
        server_name hoo.gy; 
        rewrite ^ https://app.hoo.gy$request_url?permanent;
        #other configurations go here
    } 

The previous code added a permanent redirection from http://hoo.gy to https://app.hoo.gy.

These two questions helped me to make my decision:
1. How to redirect to a different domain using NGINX
2. How to redirect requests to a different domain/url with nginx

Show Comments