rewrite rules issue

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


Hello,

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

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

if in my browser i write:
host.domain.fr/admin (without last /), then I'm redirected to
host.domain.fr/host.domain/admin/ (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,
Nico

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,258184,258184#msg-258184



More information about the nginx mailing list