Feature #2358
closedCheck if directory exists in url.rewrite-if-not-file
Updated by gstrauss about 9 years ago
- Subject changed from Check if directory exists in url.rewrte-if-not-file to Check if directory exists in url.rewrite-if-not-file
- Status changed from New to Patch Pending
diff --git a/src/mod_rewrite.c b/src/mod_rewrite.c index fac6c49..2a394b5 100644 --- a/src/mod_rewrite.c +++ b/src/mod_rewrite.c @@ -463,7 +463,7 @@ URIHANDLER_FUNC(mod_rewrite_physical) { /* skip if physical.path is a regular file */ sce = NULL; if (HANDLER_ERROR != stat_cache_get_entry(srv, con, con->physical.path, &sce)) { - if (S_ISREG(sce->st.st_mode)) return HANDLER_GO_ON; + if (S_ISREG(sce->st.st_mode) || S_ISDIR(sce->st.st_mode)) return HANDLER_GO_ON; } switch(r = process_rewrite_rules(srv, con, p, p->conf.rewrite_NF)) {
Updated by gstrauss about 9 years ago
- Target version changed from 1.4.x to 1.4.40
Updated by stbuehler almost 9 years ago
No! This breaks clearly documented behavior. url.rewrite-if-not-file
checks for regular file, not for directories.
Updated by gstrauss almost 9 years ago
- Status changed from Patch Pending to Invalid
Quoting from https://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_ModRewrite:
url.rewrite-[repeat-]if-not-file
New: For the 1.4.x branch as of 1.4.24 or r2647 from svn:
Rewrites a set of URLs internally in the webserver BEFORE they are handled and checks that files do not exist.
Take examples from above, this is to mimic ApacheĀ“s "!-f" RewriteRule. Please note this does not work for directories, pipes, sockets or alike.
Where do I want to use this? Maybe with e.g. Drupal backend, where mod_magnet (has an ApacheĀ“s -f and -d solution) might not be handy or simply "too much" for just this kind of rewrites. This closes feature request #985.
Updated by stbuehler almost 9 years ago
Just for the record: I'm not saying a feature request for a similar rewrite action checking for directories would be wrong; although I see some challenges in defining the execution order of multiple rewrite-if-not{file,directory,exists,...}
options.
Also available in: Atom