Nginx trailing slash not working

Posted by user1573604 on Server Fault See other posts from Server Fault or by user1573604
Published on 2013-11-08T00:32:33Z Indexed on 2013/11/08 3:58 UTC
Read the original article Hit count: 477

Filed under:
|
|

I am using the below to match urls and add a trailing slash. Under location /

rewrite ^([^.]*[^/])$ $1/ permanent;

According to he logs below, it is working, however the get request is still he old url, prior to adding the slash, which results in a 404.

2013/11/08 12:33:19 [notice] 29919#0: 92 "^([^.][^/])$" matches "/foo", client: 100.100.100.100, server: _, request: "GET /foo HTTP/1.1", host: "100.100.100.100" 2013/11/08 12:33:19 [notice] 29919#0: *92 rewritten redirect: "/foo/", client: 100.100.100.100, server: _, request: "GET /foo HTTP/1.1", host: "100.100.100.100"

Any suggestions as to why this might be happening?

© Server Fault or respective owner

Related posts about nginx

Related posts about webserver