Fix dependency loop in vhost

Also fix missing backslash from test for rewrites.
Merge pull request #820 from mhaskel/vhost_fixes

Fix dependency loop in vhost