Actually, the domain command won't work for this scenario if you need to support example.com and example.co.uk...
How about this instead:
when HTTP_REQUEST {
log local0. "[IP::client_addr]:[TCP::client_port]: New [HTTP::method] request to [HTTP::host][HTTP::uri]"
if { [string tolower [HTTP::host]] starts_with "preview.www."} {
log local0. "[IP::client_addr]:[TCP::client_port]: Redirecting to preview2.www.[getfield [string tolower [HTTP::host]] preview.www. 2]"
HTTP::redirect "http://preview2.www.[getfield [string tolower [HTTP::host]] preview.www. 2]"
}
}
Aaron