16. September 2016 19:34, "Francis Daly" <fran...@daoine.org> schrieb:
> * Since you already rewrite all requests that do not end in /; if you can
> confirm that your clients send the name:port in the Host header that
> they send, then you could change the rewrite destination to explicitly
> include that:
> 
> rewrite ^(.*[^/])$ http://$http_host$1/ permanent;
> 
> This would break any clients that do not send the Host: header that you
> expect -- possibly that matters; possibly it doesn't. It is not clear
> to me how your current config can work -- with the rewrite, no request
> will match your ".php$" location. If that is to change, and you have an
> enumerable list of "directories" where you want the add-a-slash redirect,
> you could create a bunch of explicit "location =" blocks that do "return
> 301" with $http_host.

Thanks alot!
I used your rewrite tipp!
I modified the rule and added a if statement:
    if (-d $request_filename) {
            rewrite [^/]$ $scheme://$http_host$uri/ permanent;
    }

I think nowdays almost every browser sends the HTTP header (i hope so)


thanks again!
----------
Niklas

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

Reply via email to