]> git.kaiwu.me - nginx.git/commitdiff
do not add tested file to a location regex string,
authorIgor Sysoev <igor@sysoev.ru>
Thu, 27 May 2010 13:24:19 +0000 (13:24 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Thu, 27 May 2010 13:24:19 +0000 (13:24 +0000)
instead, set URI to the tested file, or keep URI unchanged,
if the tested file is a directory,
the later allows to handle a directory autoredirect

src/http/ngx_http_core_module.c

index 997ed3a8d188ba9236e7d0eaf6d638948e5304a5..a91d5854b8ddf4ddf2fc042b2df613912c23a0c4 100644 (file)
@@ -1282,6 +1282,12 @@ ngx_http_core_try_files_phase(ngx_http_request_t *r,
         if (!alias) {
             r->uri = path;
 
+#if (NGX_PCRE)
+        } else if (clcf->regex) {
+            if (!test_dir) {
+                r->uri = path;
+            }
+#endif
         } else {
             r->uri.len = alias + path.len;
             r->uri.data = ngx_pnalloc(r->pool, r->uri.len);