added virtual host based rewrites

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