Project

General

Profile

« Previous | Next » 

Revision 8001

web/main/.htaccess: translate dotpaths to /-paths: Added examples

View differences:

.htaccess
25 25
RewriteCond %{REQUEST_FILENAME} -l
26 26
RewriteRule ^.*$ - [last]
27 27

  
28
# translate dotpaths to /-paths (the dotpath follows the last /)
29
# replace all unescaped . with /
28
## translate dotpaths (after the last /) to /-paths, e.g. d/a.[b.c] -> d/a/b.c/
29

  
30
# replace all unescaped . with / , e.g. a.[b.c] -> a/[b.c]
30 31
RewriteRule ^((?:.*/)?(?:[^.\[\]/]+|\[[^\[\]/]*\])+)\.([^/]+)$ $1/$2 [discardpath,next]
31 32
	# discardpath: avoids infinite loop with paths like a/b.c
33

  
32 34
# seal the /-path so the filename part is not reinterpreted as a dotpath
35
# e.g. a/[b.c] -> a/[b.c]/ so it doesn't become a/b/c after []-unescaping
36
# this is needed because mod_rewrite often runs the same rules again
33 37
RewriteRule ^.*[^/]$ $0/
34
# remove all [] escapes (but leave empty [])
38

  
39
# remove all [] escapes (but leave empty []), e.g. a/[b.c]/ -> a/b.c/
35 40
RewriteRule ^(.*)\[([^\[\]]+)\](.*)$ $1$2$3 [discardpath,next]
36 41

  
42

  
37 43
# non-filesystem paths
38 44
ErrorDocument 404 /

Also available in: Unified diff