<div dir="ltr"><div dir="ltr"><div dir="ltr"><div>I found a solution (after reading the manual)</div><div><a href="http://nginx.org/en/docs/http/ngx_http_rewrite_module.html">http://nginx.org/en/docs/http/ngx_http_rewrite_module.html</a><br></div><div dir="ltr">On Thu, 7 Mar 2019 at 14:57, Hans Schou <<a href="mailto:hsc@miracle.dk">hsc@miracle.dk</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div>Example of required redirect:</div><div><a href="http://ex.org/foo" target="_blank">http://ex.org/foo</a> -> <a href="https://ex2.org/foo/" target="_blank">https://ex2.org/foo/</a>    # Nx solves the bug here</div><div><div><a href="http://ex.org/foo/" target="_blank">http://ex.org/foo/</a> -> <a href="https://ex2.org/foo/" target="_blank">https://ex2.org/foo/</a></div><div><a href="http://ex.org/foo/?id=7" target="_blank">http://ex.org/foo/?id=7</a> -> <a href="https://ex2.org/?id=7" target="_blank">https://ex2.org/?id=7</a></div></div></div></div></blockquote><div></div></div><div><br></div><div>"rewrite" is the way to go.</div><div>To change /foo or /foo/ to /foo/ and don't change the rest, this will do it:</div><div><div>location ~ /(foo|bar) {</div><div>    rewrite ^(/[^/]+)/? <a href="https://ex2.org">https://ex2.org</a>$1/ permanent;</div><div>}<br></div></div><div><br></div><div>If any path should be handled this way:</div><div><div><div>location / {</div><div>    rewrite ^(/[^/]+)/? <a href="https://ex2.org">https://ex2.org</a>$1/ permanent;</div><div>}<br></div></div><br class="gmail-Apple-interchange-newline"></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><br></div><div dir="ltr"><span style="color:rgb(0,0,0);font-family:Arial,sans-serif;font-size:12px"><p>Venlig hilsen - best regards</p></span></div></div></div></div></div></div></div></div></div>