rewrite rules issue

nicocolt nginx-forum at
Sat Apr 18 20:08:54 UTC 2015


I have an issue with a rewrite rule for redirect to a subdomain. Here it

if ($http_host = "") {
            rewrite ^(?!/\b(subpath|stats|error)\b)/(.*)$ /subpath/$2 last;

if in my browser i write: (without last /), then I'm redirected to (with a 404 error of course)

But if i write:
host.domain/admin/ (with last /), then all works fine.

I don't understand what is the configuration issue. I want to have the same
behaviour with or without last /
Any help would be helpfull.

Best regards,

Posted at Nginx Forum:,258184,258184#msg-258184

More information about the nginx mailing list