added virtual host rewrite support

Made some changes so virtual host based rewrites are possible as a part of the configuration.