Revision 8017
Added by Aaron Marcuse-Kubitza almost 12 years ago
.htaccess | ||
---|---|---|
17 | 17 |
RewriteCond %{HTTP_HOST} ^(.*)(\.[^.]*){2}$ |
18 | 18 |
RewriteCond ${subdomain2path:%1} ^([^/]*).*$ |
19 | 19 |
RewriteCond expr "! $0 -fnmatch '%1*'" |
20 |
RewriteRule ^.*$ %0/$0 [discardpath,noescape,last]
|
|
20 |
RewriteRule ^.*$ %0/$0 [discardpath,noescape] |
|
21 | 21 |
|
22 | 22 |
# don't rewrite existing paths |
23 | 23 |
RewriteCond %{REQUEST_FILENAME} -d [ornext] |
... | ... | |
28 | 28 |
## translate dotpaths (after the last /) to /-paths, e.g. d/a.[b.c] -> d/a/b.c/ |
29 | 29 |
|
30 | 30 |
# replace all unescaped . with / , e.g. a.[b.c] -> a/[b.c] |
31 |
RewriteRule ^((?:.*/)?(?:[^.\[\]/]*|\[[^\[\]/]*\])*)\.([^/]*)$ $1/$2 [discardpath,noescape,next] |
|
31 |
# remove up to two [] escapes per dot-level, e.g. a.[b.c]=[d.e] -> a/b.c=d.e |
|
32 |
RewriteCond $2 ^(.*)(?:\[([^\[\]]*)\](.*))?(?:\[([^\[\]]*)\](.*))?$ |
|
33 |
RewriteRule ^((?:.*/)?(?:[^.\[\]/]*|\[[^\[\]/]*\])*)\.([^/]*)$ $1/%1%2%3%4%5 [discardpath,noescape,next] |
|
32 | 34 |
# discardpath: avoids infinite loop with paths like a/b.c |
33 | 35 |
|
34 | 36 |
# seal the /-path so the filename part is not reinterpreted as a dotpath |
... | ... | |
36 | 38 |
# this is needed because mod_rewrite often runs the same rules again |
37 | 39 |
RewriteRule ^.*[^/]$ $0/ [discardpath,noescape] |
38 | 40 |
|
39 |
# remove all [] escapes, e.g. a/[b.c]/ -> a/b.c/ |
|
40 |
RewriteRule ^(.*)\[([^\[\]]*)\](.*)$ $1$2$3 [discardpath,noescape,next] |
|
41 | 41 |
|
42 |
|
|
43 | 42 |
# non-filesystem paths |
44 | 43 |
ErrorDocument 404 / |
Also available in: Unified diff
web/main/.htaccess: translate dotpaths: Fixed bug where can't remove all [] escapes, because this would also remove [] from protected parts of the URL (i.e. before the last /). Instead just remove up to two [] escapes per dot-level, e.g. a.[b.c]=[d.e] -> a/b.c=d.e . Note that this removes the restriction against URLs containing "[]", because these [] will be left as-is as long as they are followed at some point by a / .