Project

General

Profile

« Previous | Next » 

Revision 8028

web/main/.htaccess: translate dotpaths: Require any [] escape to have the ] at the end of the level, to simplify the [] regexp

View differences:

.htaccess
25 25

  
26 26
## translate dotpaths (after the last /) to /-paths, e.g. d/a.[b.c] -> d/a/b.c/
27 27
# replace all unescaped . with / , e.g. a.[b.c] -> a/[b.c]
28
# remove up to one [] escape per dot-level, e.g. a.b=[c.d] -> a/b=c.d
29
RewriteCond $2 ^([^\[\]]*)(?:\[([^\[\]]*)\]([^\[\]]*))?$
28
# remove any [] escape, e.g. a.b=[c.d] -> a/b=c.d (the ] must be at the end)
29
RewriteCond $2 ^([^\[\]]*)(?:\[([^\[\]]*)\])?$
30 30
# if no . suffix, seal /-path so the filename is not reinterpreted as a dotpath
31 31
# e.g. a/[b.c] -> a/[b.c]/ so it doesn't become a/b/c after []-unescaping
32 32
# this is needed because mod_rewrite often runs the same rules again
33
RewriteRule ^(.*/)?((?=.)(?:[^.\[\]/]*|\[[^\[\]/]*\])*)(?:\.([^/]*))?$ $1%1%2%3%4%5/$3 [discardpath,noescape,next]
33
RewriteRule ^(.*/)?((?=.)(?:[^.\[\]/]*|\[[^\[\]/]*\])*)(?:\.([^/]*))?$ $1%1%2/$3 [discardpath,noescape,next]
34 34
	# discardpath: avoids infinite loop with paths like a/b.c
35 35

  
36 36
# non-filesystem paths

Also available in: Unified diff