</usage>
</directivesynopsis>
<directivesynopsis>
+<name>DirectorySlashNotFound</name>
+<description>Toggle sending a HTTP 404 error in place of a trailing slash</description>
+<syntax>DirectorySlashNotFound On|Off</syntax>
+<default>DirectorySlashNotFound Off</default>
+<contextlist><context>server config</context><context>virtual host</context>
+<context>directory</context><context>.htaccess</context></contextlist>
+<override>Indexes</override>
+<compatibility>Added in 2.5.1</compatibility>
+
+<usage>
+ <p>The <directive>DirectorySlashNotFound</directive> directive determines whether
+ <module>mod_dir</module> should return an HTTP 404 status code where it would
+ otherwise have redirected the request to include a trailing slash. </p>
+</usage>
+</directivesynopsis>
+<directivesynopsis>
<name>FallbackResource</name>
<description>Define a default URL for requests that don't map to a file</description>
<syntax>FallbackResource disabled | <var>local-url</var></syntax>
moddir_cfg checkhandler;
int redirect_index;
const char *dflt;
+ moddir_cfg do_slash_notfound;
} dir_config_rec;
#define DIR_CMD_PERMS OR_INDEXES
d->do_slash = arg ? MODDIR_ON : MODDIR_OFF;
return NULL;
}
+static const char *configure_slash_notfound(cmd_parms *cmd, void *d_, int arg)
+{
+ dir_config_rec *d = d_;
+
+ d->do_slash_notfound = arg ? MODDIR_ON : MODDIR_OFF;
+ return NULL;
+}
static const char *configure_checkhandler(cmd_parms *cmd, void *d_, int arg)
{
dir_config_rec *d = d_;
"a list of file names"),
AP_INIT_FLAG("DirectorySlash", configure_slash, NULL, DIR_CMD_PERMS,
"On or Off"),
+ AP_INIT_FLAG("DirectorySlashNotFound", configure_slash_notfound, NULL, DIR_CMD_PERMS,
+ "On or Off"),
AP_INIT_FLAG("DirectoryCheckHandler", configure_checkhandler, NULL, DIR_CMD_PERMS,
"On or Off"),
AP_INIT_TAKE1("DirectoryIndexRedirect", configure_redirect,
new->index_names = NULL;
new->do_slash = MODDIR_UNSET;
+ new->do_slash_notfound = MODDIR_UNSET;
new->checkhandler = MODDIR_UNSET;
new->redirect_index = REDIRECT_UNSET;
return (void *) new;
new->index_names = add->index_names ? add->index_names : base->index_names;
new->do_slash =
(add->do_slash == MODDIR_UNSET) ? base->do_slash : add->do_slash;
+ new->do_slash_notfound =
+ (add->do_slash_notfound == MODDIR_UNSET) ? base->do_slash_notfound : add->do_slash_notfound;
new->checkhandler =
(add->checkhandler == MODDIR_UNSET) ? base->checkhandler : add->checkhandler;
new->redirect_index=
return DECLINED;
}
+ if (d->do_slash_notfound == MODDIR_ON) {
+ return HTTP_NOT_FOUND;
+ }
+
/* Only redirect non-get requests if we have no note to warn
* that this browser cannot handle redirs on non-GET requests
* (such as Microsoft's WebFolders).