I found a solution (after reading the manual)
http://nginx.org/en/docs/http/ngx_http_rewrite_module.html
On Thu, 7 Mar 2019 at 14:57, Hans Schou <[email protected]> wrote:

> Example of required redirect:
> http://ex.org/foo -> https://ex2.org/foo/    # Nx solves the bug here
> http://ex.org/foo/ -> https://ex2.org/foo/
> http://ex.org/foo/?id=7 -> https://ex2.org/?id=7
>

"rewrite" is the way to go.
To change /foo or /foo/ to /foo/ and don't change the rest, this will do it:
location ~ /(foo|bar) {
    rewrite ^(/[^/]+)/? https://ex2.org$1/ permanent;
}

If any path should be handled this way:
location / {
    rewrite ^(/[^/]+)/? https://ex2.org$1/ permanent;
}

-- 

Venlig hilsen - best regards
_______________________________________________
nginx mailing list
[email protected]
http://mailman.nginx.org/mailman/listinfo/nginx

Reply via email to