I want URLs with the host foobar.com to be rewritten to www.foobar.com. How can I do this with g-wan?
There's a G-WAN rewrite example here (look at the second handler source code, the first handler example illustrates FLV pseudo-streaming).
You can Use a virtual host, or even an alias, see the G-WAN FAQs.
For more elaborate rewrites, you can use a handler, some examples are provided in the download archive.