Two ways to serve up static files that are not in the context of the controller.xql:
if (contains($currentUri, 'pix/')) then <dispatch xmlns="http://exist.sourceforge.net/NS/exist"> <forward absolute="no" url="{concat('/../data/pix/', $exist:resource)}"/> </dispatch>
if (contains($currentUri, 'graphics/')) then <dispatch xmlns="http://exist.sourceforge.net/NS/exist"> <forward absolute="yes" url="{concat('/rest/db/data/graphics/', substring-after($currentUri, 'graphics/'))}"/> </dispatch>
This is commonly used when e.g. the site logic and controller are in /db//site (which may be mapped to a subdomain), controlled by admin, while the content needs to be controllable by editors (so it's in e.g. a /db/data). I've had to re-figure this out a couple of times, so I'm blogging it for future reference.