web/.htaccess: auto-detect dotpath: need to explicitly set usernames_disabled=1, because for some reason the `%{QUERY_STRING} =""` check doesn't detect a query string
web/.htaccess: auto-detect dotpath: removed handling of no longer used @ prefix (used to be used by username-based prefix subpaths)
bugfix: web/.htaccess: username-based prefix subpaths: usernames_disabled: also need to support it being set in the current round
bugfix: web/.htaccess: username-based prefix subpaths: removed support for query strings because these are often used at the root level, and should then be treated as a regular dotpath rather than something with a username-based prefix
bugfix: web/.htaccess: forced mod_autoindex listing: use $usernames_disabled to ensure that usernames stay disabled even when /all path is removed
bugfix: web/.htaccess: username-based prefix subpaths: added back usernames_disabled env var, because it is needed if a RewriteRule in a previous round creates an empty path (mod_rewrite runs the RewriteRules repeatedly until no replacements are made)
bugfix: web/.htaccess: username-based prefix subpaths: REDIRECT_REQUEST_URI: also allow it to be unset, as it is when using usernames
web/.htaccess: username-based prefix subpaths: removed usernames_disabled env var because the bug that appeared to require this has now been fixed
bugfix: web/.htaccess: username-based prefix subpaths: also need to check original URL (REDIRECT_REQUEST_URI), in addition to current URL (REQUEST_URI) to see if usernames should be disabled
web/.htaccess: username-based prefix subpaths: allow explicitly disabling in a RewriteRule to handle special cases
web/.htaccess, username_prefix.php: username-based prefix subpaths: don't require the // at the end , to avoid clutter. IMPORTANT: in order to access the home page after visiting a URL with a username, you must now append "." to the host ("vegpath.org.") (other pages are not affected by this problem). since vegpath.org is a URL shortener, this is a worthwhile tradeoff to avoid needing the // suffixes everywhere.
bugfix: web/.htaccess: subdomains: each path element must be non-empty, to avoid matching a trailing . incorrectly
web/.htaccess: username-based prefix subpaths: updated documentation to use leading // instead of trailing ? or ?@
fix: web/.htaccess: username-based prefix subpaths: changed format to subpath@host//path because the trailing ? makes it look like the sentence the URL is in is a question
web/.htaccess: auto-detect dotpath in query string: also auto-prepend & for query strings appended to a username-based prefix, so that these don't need to have & manually prepended to make them appendable
web/.htaccess: auto-detect dotpath in query string: also auto-detect dotpath for query strings appended to a username-based prefix, so that these don't need to have . prepended to make them appendable
web/.htaccess, username_prefix.php: username-based prefix subpaths: support dotpath in query string (which will be appended verbatim to the prefix). use "__?@__" instead of "__?__&" to signal username-based prefix, so that the query string does not end in a dangling & .
bugfix: web/.htaccess: auto-detect dotpath in query string: don't exclude dotpaths that come before a normal query string (&k=v...)
web/.htaccess: auto-detect dotpath in query string: documented what each RewriteCond does
web/.htaccess: auto-detect dotpath in query string: use %{QUERY_STRING} instead of %0 for clarity
web/.htaccess, web/username_prefix.php: username-based prefix subpaths: support query strings in addition to paths
web/.htaccess: handle username-based prefix subpaths (of the form "subpath@url?") for all paths rather than just for the root (which were handled by index.php)
web/.htaccess: for dirs, redirect to index.*: document it is actually just the filename "index" that MultiViews is broken for, other filenames work fine
bugfix: web/.htaccess: for dirs, redirect to index.*: added workaround for Ubuntu 14.04, which breaks MultiViews
moved everything into /trunk/ to create the standard svn layout, for use with tools that require this (eg. git-svn). IMPORTANT: do NOT do an `svn up`. instead, re-use your working copy's existing files with `svn switch` (http://svnbook.red-bean.com/en/1.6/svn.ref.svn.c.switch.html).
web/.htaccess: mod_autoindex: show .* files which are normally hidden, because these are important parts of our codebase. (the leading . is not used for access controls.) .svn folders will remain hidden to avoid clutter.
web/.htaccess: mod_autoindex: IndexHeadInsert: use IndexStyleSheet for stylesheet link instead
bugfix: web/.htaccess: mod_autoindex: IndexOptions: use +HTMLTable to ensure that the contents are always displayed in an HTML table, even when a header file is provided with HeaderName (which turns off the default HTML table for some reason)
bugfix: web/.htaccess: auto-detect dotpath in query string: need to include the path ($0) in the replacement, to avoid reverting to the root dir. (mod_rewrite replacements are not like relative URLs, which would interpret ?... as being relative to the current path, not the root.)
bugfix: web/.htaccess: auto-detect dotpath in query string: added missing $ at end of regexp
bugfix: web/.htaccess: parse dotpath in query string: make dotpath replacement start with ./ instead of / (which would incorrectly create an absolute URL path). this bug only appears when there is a trailing /, because this causes the matched text to be empty instead of a filesystem path with leading /.
bugfix: web/.htaccess: parse dotpath in query string: redirect so REQUEST_URI is populated from REQUEST_FILENAME: need to use - instead of $0 as the redirect destination so that REQUEST_FILENAME is used instead of the empty REQUEST_URI (i.e. the redirect vars are left untouched)
bugfix: web/.htaccess: parse dotpath in query string: need to add trailing / if dotpath so that dest path is URL path, not filesystem path (when trailing / missing, matched path is filesystem path)
bugfix: web/.htaccess: need to do DirectoryIndex redirects before checking for existing file/dir, because a DirectoryIndexed dir is existing but still needs to be redirected to the index.* file
web/.htaccess: mod_autoindex: use the main.css stylesheet to match the look-and-feel of index.php
web/.htaccess: mod_autoindex: Note that some listed files are not web-accessible: use ' instead of " to avoid \-escaping embedded "
web/.htaccess: mod_autoindex: sort by description when provided, to allow setting a custom (non-alphabetical) sort order using AddDescription
web/.htaccess: mod_autoindex: added note that some listed files are not web-accessible. they will produce a "Forbidden" error when clicked.
web/.htaccess: added mod_autoindex IndexOptions, in particular FoldersFirst
bugfix: web/.htaccess: changed "mod_dir listing"->"mod_autoindex listing" because mod_dir does not actually handle the autogenerated listings
bugfix: web/.htaccess: DirectoryIndex: use disabled instead of on because on is actually treated as a filename, and does not invoke mod_autoindex. the DirectoryIndex directive and the mod_dir module actually apply only to manual index files, not to autogenerated dir listings (which are handled by mod_autoindex).
web/.htaccess: <dir>/all forces mod_dir listing: use simpler $mod_dir_listing env var instead of query string modification to indicate that an explicit mod_dir listing should be displayed. this causes /all to replace ?index=1 as the way to force a mod_dir listing. note that the %{ENV:...} test needs to use $REDIRECT_mod_dir_listing instead of $mod_dir_listing, because a redirect will occur between the /all rule and the index.* rule, causing all env vars to be prepended with REDIRECT_ .
web/.htaccess: <dir>/all forces mod_dir listing, as a simpler syntax than ?index=1
web/.htaccess: for dirs, redirect to index.*: allow requesting a mod_dir listing instead with ?index=1
web/.htaccess: handle DirectoryIndex redirects in a RewriteRule instead of with `DirectoryIndex index`, so that RewriteConds can be used to configure when index.* is used as the DirectoryIndex instead of a mod_dir listing
web/.htaccess: handle DirectoryIndex subrequests when there is no DirectoryIndex: moved comment about -F subrequest after line it applies to
web/.htaccess: RewriteRules: added standard [discardpath,noescape,qsappend] options where missing (these should be the default, but aren't)
web/**/.htaccess: RewriteRules: ensured flags are in alphabetical order
web/.htaccess: parse dotpath in query string: moved parsing from dotpath.php to RewriteRules. with the eventual addition of config env vars, this makes it possible for subdirs to configure their own dotpath parsing, rather than having all levels of the dotpath translated to a URL path. (for inner levels, it may el.g. be more appropriate to parse the dotpath as query params or pass it along to an external URL.) note that it takes only two lines of mod_rewrite (plus a workaround RewriteRule) to replace over a dozen lines of PHP code.
web/.htaccess: renamed REQUEST_URI_no_/ to REQUEST_URI_no_extra_/ to clarify that only an excess / is removed
web/.htaccess: moved set REQUEST_URI_no_/ under translate subdomain to path because it needs to be set right before being used to be accurate
web/.htaccess: setting REQUEST_URI_no_/: use one RewriteCond instead of two since the regexps can be combined
web/.htaccess: parse dotpath in query string: removed dotpath auto-detection code because this is now handled by a separate RewriteRule
web/.htaccess: auto-detect dotpath in query string (having a . before any = ) and mark it using a leading . . this is done as a separate step so that the dotpath is already explicitly marked as such when it's parsed.
web/.htaccess: prepend dir name if it's part of the filename: support MultiViews filenames without the extension, by using a lookahead request -F instead of a regular -f
web/.htaccess: prepend dir name if it's part of the filename (this works only if the dir supports relative redirects and sets %{ENV:innermost_dir})
web/.htaccess: parse dotpath in query string: heuristically detect query strings that don't contain dotpaths (such as mod_autoindex sort conditions), rather than always interpreting the part before the first & as the dotpath. now, the part before the first & will be interpreted as a dotpath if it has a . before any = . (query param names containing . are rare, so this usually works correctly.) note that you can always prepend . to force a dotpath, or & to force a query param.
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).
web/.htaccess: moved auto-add trailing / to after don't rewrite existing dirs, so that the path will automatically not be rewritten if it contains a trailing / and is a dir
web/.htaccess: don't rewrite existing paths: only prevent existing dirs with trailing / from being rewritten, because dirs without trailing / may be redirected
web/.htaccess: auto-add trailing / if not external redirect: added test if `%{REQUEST_FILENAME} -d` in addition to checking %{LA-F:REQUEST_FILENAME}, because there are some cases (e.g. subdirs that are symlinked outside the DOCUMENT_ROOT) where LA-F:REQUEST_FILENAME for some reason appends /home to the REQUEST_FILENAME, but the current REQUEST_FILENAME is fortunately already a dir and can be checked directly
web/.htaccess: auto-add trailing / if not external redirect: removed no longer applicable comment that dir without trailing / is provided as an absolute filesystem path, because this is only true in inner .htaccess files for their top-level dirs
bugfix: web/.htaccess: auto-add trailing / if not external redirect: match any path that does not end in / (and satisfies the -d lookahead), rather than only absolute filesystem paths, which are only applicable in inner .htaccess files (and even then only for the outermost dir they control) but not in the top-level .htaccess file. Note that the inner .htaccess files can still use ^/ to match their own dir, just not their subdirs, without a trailing / .
bugfix: web/.htaccess: auto-add trailing / if not external redirect: replace with "%{REQUEST_URI}/" instead of the empty string (which gets auto-translated to have a trailing /), because the empty string only works in the top-level dir of the .htaccess file (it redirects to the RewriteBase, which ends in /). The entire REQUEST_URI is needed to do the auto-add in dirs which do not have their own auto-add trailing / rule. Also, using REQUEST_URI avoids the need to (sometimes) set RewriteBase for use by relative URLs in replacement strings, because this is an absolute URL instead. Setting RewriteBase manually is best avoided, because it hardcodes the URL path to the .htaccess file, which may change.
bugfix: web/.htaccess: auto-add trailing / if not external redirect: use "%{LA-F:REQUEST_FILENAME} d" instead of "$0 -F" so that the actual value of REQUEST_FILENAME tested, and $0 can also match strings which are not file paths. This is because only those no-trailing/-paths which did not match the RewriteBase are provided to mod_rewrite as absolute filepaths, but RewriteBase is not an issue in the outermost .htaccess (because the RewriteBase is / , which is always matched). This means the method of testing for ^/ to match a no-trailing-/-path will only work in inner .htaccess files (where it is currently used extensively).
web/.htaccess: bugfix: moved auto-add trailing / if not external redirect to before don't rewrite existing paths because the trailing / also needs to be added on paths which are existing paths, but are just missing the trailing /
web/.htaccess: auto-add trailing / if not external redirect (limited form of DirectorySlash). this allows URLs without trailing /, for dirs which have a special external redirect to the datasource's homepage when there is no trailing /, but still auto-adds the trailing / for all other dirs.
web/**/.htaccess: Use [qsappend] flag with all RewriteRules to ensure that the original query string is never lost
web/.htaccess: handle DirectoryIndex subrequests when there is no DirectoryIndex, by deleting the /index filename. This ensures that any fallback redirect is not invoked, and instead the action corresponding to a trailing / (usually the display of a directory listing) is performed.
web/.htaccess: Support rules being inherited by subdirs using InheritBefore, by setting an env var $innermost_dir that stores the name of the innermost subdir to contain an .htaccess file. This env var can then be tested for in a RewriteCond in rules that should only apply locally. This works because SetEnvIf processes directives from the outer dir to the inner dir, so that the inner dir's setting comes last and is the final value of $innermost_dir. Note that you must use SetEnvIf rather than SetEnv because "The internal environment variables set by [SetEnv] are set after most early request processing directives are run, such as access control and URI-to-filename mapping. If the environment variable you're setting is meant as input into this early phase of processing such as the RewriteRule directive, you should instead set the environment variable with SetEnvIf." [emphasis added] (http://httpd.apache.org/docs/current/mod/mod_setenvif.html#setenvif)
web/.htaccess: don't rewrite existing paths: Changed match string to what is used in subdirs, so that if this rule is inherited, what is considered an existing path (i.e. a file or subdir) is restricted appropriately
web/**/.htaccess: no-replacement RewriteRules: Removed the standard [discardpath,noescape] flags because they add unnecessary clutter and are not needed for this type of rule. Note that these flags are still required on regular RewriteRules which have a replacement string.
web/**/.htaccess: no-replacement RewriteRules: Use just ^ as the match string because there is no need to actually match characters. This also makes it easy to visually tell what is a no-replacement RewriteRule vs. a RewriteRule that matches the entire path.
web/.htaccess: Renamed $REQUEST_URI_NO_SLASH to $REQUEST_URI_no_/ to take advantage of (some) special chars being allowed in env var names
web/.htaccess: fallback redirect: Use new VegCore/ instead of specifying the full wiki URL
web/.htaccess: translate subdomain to path: Use new REQUEST_URI_NO_SLASH to avoid adding an automatic trailing / when a subdir was reached as a subdomain without a path (e.g. VegBank.vegpath.org), which should be equivalent to going to the subdir's homepage (vegpath.org/VegBank) rather than to its directory listing (vegpath.org/VegBank/ ; note the trailing /)
web/.htaccess: set REQUEST_URI_NO_SLASH for use by translating subdomain to path
web/.htaccess: Use new %{REQUEST_SCHEME} to construct self-refential URLs
web/**/.htaccess: RewriteOptions: Removed inherit because if the destination is not found in the current dir, a 404 should be returned instead of trying to invoke the parent dir's fallback handler (which applies only to paths in the parent dir). Ideally, we would use InheritBefore to get the subdomain preprocessing, etc., but the parent dir's fallback handler would still need to be turned off somehow when the rule was being run by a subdir.
web/.htaccess: Only forward specific terms (subpaths) to VegCore, not also the dir index itself
web/**/.htaccess: RewriteOptions: Added AllowNoSlash (available in Apache 2.4) so dir paths without the trailing / can be parsed by mod_rewrite
web/.htaccess: Turned off DirectorySlash so that the dir without the trailing / can have a separate meaning (e.g. as the home page of a datasource, rather than a listing of the short URLs available for it)
web/**/.htaccess: parse dotpath in the query string: Use just dotpath instead of dotpath.php because the extension is added automatically by MultiViews
web/**/.htaccess: parse dotpath in the query string: Remove any index.* suffix, which is added by MultiViews in Apache 2.4
web/.htaccess: Set Options +Indexes because this isn't the default in Apache 2.4
web/.htaccess: DirectoryIndex: Use index instead of hardcoding index.php because MultiViews will now add the appropriate extension automatically
web/.htaccess: Turn on MultiViews to allow auto-adding of the file extension
web/.htaccess: use separate lowercase version when available: Support paths without a trailing /
web/.htaccess: use separate lowercase version when available: Fixed bug where need to use [last] flag, in order to rewrite in the new subdir instead of applying the rest of this dir's rules (which would forward to VegCore)
web/.htaccess: Use %{REQUEST_URI} ("The path component of the requested URI" <http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritecond>) instead of /$0, in order to preserve whether or not the path had a trailing slash. This also ensures that the rule functions correctly if it is invoked in a subdir context, which may occur for the "remove www subdomain" rule.
web/.htaccess: Removed "don't redirect subdir paths" because this is now handled by "don't rewrite existing paths" as described in r8375
Renamed www/ back to web/
web/: Moved auxiliary files into the main/ subdir in preparation for having just the web/ dir. Renamed web/ to www/ so it can be replaced with web/main/.
web/main/**/.htaccess: Support dotpaths in the query string instead of in the path, so that non-dotpath paths don't need to be suffixed with / to prevent their filenames from being interpreted as dotpaths. Putting dotpaths in the query string still requires only one character between the host and the path, but it's ? instead of / . ? is in many ways more natural, because the dotpath is a non-filesystem string to be parsed rather than something that's already a filesystem path. This change also avoids the need to strip trailing /s in many RewriteRules, because the dotpath mechanism is no longer appending them.
web/main/.htaccess: remove linewraps (of the form table.path.vg/_-term) used to create a newline for Google spreadsheets
web/main/**/.htaccess: Removed RewriteCond -l tests because one of the -d or -f tests will always also pass, making the -l test unnecessary
web/main/.htaccess: use separate lowercase version when available: Also support input strings in mixed case which is not the default capitalization, in addition to all-lowercase strings
web/main/.htaccess: use separate lowercase version when available: Generate the new dirname with a separate RewriteCond so its value can be used both in the -d test and in the replacement string, rather than separately for each
web/main/.htaccess: translate dotpaths: Allow an unescaped . at the beginning of a filename, because this will never be a . separator. This adds support for hidden files in dir paths, which now won't be interpreted as dotpaths. However, regular files with extensions still need to have the filename escaped because it will otherwise be interpreted as a dotpath.