diff options
Diffstat (limited to 'doc/vmod-dbrw.texi')
-rw-r--r-- | doc/vmod-dbrw.texi | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/doc/vmod-dbrw.texi b/doc/vmod-dbrw.texi index 40fc84d..31b15d1 100644 --- a/doc/vmod-dbrw.texi +++ b/doc/vmod-dbrw.texi @@ -496,19 +496,29 @@ ORDER BY weight @end example @noindent -Furthermore, the @code{url} column can contain a SQL wildcard pattern, -in which case the query will look like: +Furthermore, the @code{url} column can contain a path prefix, +which can be matched using the @code{IN} conditional: @example @group SELECT dest,pattern,value,flags FROM rewrite WHERE host='$host' -AND '$url' like $url +AND url IN ($(urlprefixes $url)) ORDER BY weight @end group @end example +Notice the use of the @samp{$(urlprefixes $url)}. This invokes the built-in +@dfn{function} @code{urlprefixes}, which expands to comma-separated +list of properly quoted pathname prefixes, constructed from its +argument. For example, if @samp{$url} is @samp{/local/user/local?a=1}, +then the expansion of @samp{$(urlprefixes $url)} is: + +@example +'/local/user/local','/local/user','/local' +@end example + @node Rewrite @chapter The @code{rewrite} Function |