Revision 8483
Added by Aaron Marcuse-Kubitza over 11 years ago
.htaccess | ||
---|---|---|
51 | 51 |
RewriteCond %{REQUEST_FILENAME} -f |
52 | 52 |
RewriteRule ^.+$ - [discardpath,noescape,last,qsappend] |
53 | 53 |
|
54 |
# auto-add trailing / if not external redirect (limited form of DirectorySlash)
|
|
55 |
RewriteCond %{REQUEST_FILENAME} -d [ornext]
|
|
56 |
RewriteCond %{LA-F:REQUEST_FILENAME} -d
|
|
57 |
RewriteRule ^.+(?<!/)$ %{REQUEST_URI}/ [discardpath,noescape,last,redirect,qsappend]
|
|
54 |
# auto-add trailing / unless has an .htaccess with possible redirect
|
|
55 |
RewriteCond %{REQUEST_FILENAME} -d |
|
56 |
RewriteCond %{REQUEST_FILENAME}/.htaccess !-f
|
|
57 |
RewriteRule ^.+$ %{REQUEST_URI}/ [discardpath,noescape,last,redirect,qsappend] |
|
58 | 58 |
|
59 | 59 |
# handle DirectoryIndex subrequests when there is no DirectoryIndex |
60 | 60 |
# use -F subrequest so that MultiViews auto-appends any extension |
Also available in: Unified diff
bugfix: web/.htaccess: auto-add trailing /: %{LA-F:REQUEST_FILENAME} lookaheads don't work, because they do not show the externally redirected URL, so we need to use an alternate mechanism instead, which just assumes that any dir containing an .htaccess file may contain a redirect and ignores just those dirs (subdirs are not ignored and will receive a trailing / as expected). To create the trailing / effect when you have a .htaccess without an external redirect, you need to manually tell it to correct the path for just that dir without the / (i.e. match ^/ , because a trailing / causes mod_rewrite to use an absolute filesystem path instead).