Project

General

Profile

« Previous | Next » 

Revision 13629

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

View differences:

trunk/web/.htaccess
15 15

  
16 16
# auto-detect dotpath in query string (having a . or & before any = )
17 17
# you can prepend . to force a dotpath, or & to force a query param
18
# must come before username prefix parsing, because it requires the leading "."
18
# must come before username prefix parsing, because it requires the leading [.&]
19 19
RewriteCond %{QUERY_STRING} ^(?!@?[.&]).+$
20
	# . not already prepended, does not start with & , and non-empty
20
	# [.&] not already prepended and non-empty
21 21
RewriteCond %{QUERY_STRING} ^@?[^=]*(?:[.&]|$)
22 22
	# . or & before any =
23 23
RewriteCond %{QUERY_STRING} ^(@?)(.*)$
24 24
RewriteRule ^.*$ $0?%1.%2 [discardpath,noescape]
25
# otherwise, prepend & to force a query param
26
RewriteCond %{QUERY_STRING} ^(?!@?[.&]).+$
27
	# [.&] not already prepended and non-empty
28
RewriteCond %{QUERY_STRING} ^(@?)(.*)$
29
RewriteRule ^.*$ $0?%1&%2 [discardpath,noescape]
25 30

  
26 31
# handle username-based prefix subpaths of the form "subpath@url?" or "__?@__"
27
# supports multiple @ , nested . , & query str: a@b.c@url?@.d&q -> url?b.c.a.d&q
32
# supports multiple @ , nested . , & query str: a@b.c@url?@d&q -> url?b.c.a.d&q
28 33
# ( @ is effectively a placeholder for the decoded username prefix)
29 34
# better than subpath.host because case is preserved and special chars allowed
30 35
# must require trailing ? , to avoid needing login to view the page itself

Also available in: Unified diff