Question

How can Redirect all url on https except one url with nginx vhost

I have setup Angular8 project under nginx reverse proxy but I want to redirect all URL request on https except one URL(LIKE /PLAYER work on http) how can I handle this redirection with Nginx vhost.

Thanks & Regards, Ravinderpal Singh

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi @RvSingh013,

The following server block should do the trick for you:

location / {
    rewrite ^/(.*)$ http://www.Domain.here/$1 permanent;
}

location /123456.txt {
    root /path/to/webroot;
}

Please note you’ll need to change the destination on the first location and the URL and root path for the second location for this to work.