Revision 8443
Added by Aaron Marcuse-Kubitza over 11 years ago
web/.htaccess | ||
---|---|---|
10 | 10 |
RewriteEngine on |
11 | 11 |
RewriteOptions AllowNoSlash |
12 | 12 |
|
13 |
SetEnvIf Request_URI ^ innermost_dir=/ |
|
14 |
|
|
13 | 15 |
# remove www subdomain |
14 | 16 |
RewriteCond %{HTTP_HOST} ^www\.(.*)$ |
15 | 17 |
RewriteRule ^.*$ %{REQUEST_SCHEME}://%1%{REQUEST_URI} [discardpath,noescape,last] |
... | ... | |
28 | 30 |
RewriteRule ^.*$ %{REQUEST_SCHEME}://%2/${subdomain2path:%1}%{ENV:REQUEST_URI_no_/} [discardpath,noescape,last] |
29 | 31 |
|
30 | 32 |
# use separate lowercase version when available |
33 |
RewriteCond %{ENV:innermost_dir} =/ |
|
31 | 34 |
RewriteCond %{DOCUMENT_ROOT}/$1 !-d |
32 | 35 |
RewriteCond .${tolower:$1} ^.*$ |
33 | 36 |
RewriteCond %{DOCUMENT_ROOT}/%0 -d |
... | ... | |
47 | 50 |
|
48 | 51 |
## specific to / |
49 | 52 |
|
53 |
RewriteCond %{ENV:innermost_dir} =/ |
|
50 | 54 |
RewriteRule ^.+$ /VegCore/$0 [discardpath,noescape,last] |
Also available in: Unified diff
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)