You can also do this through mod rewrite, but I’ve hit a few problems with doing it that way – mostly around subdomains. Seems like something interworx is doing to support subdomains via mod rewrite causes redirects to not work very well (various things like redirecting to the www instead of subdomain, adding on the subdomain to the path, etc, seemed to happen no matter how I tweaked my rewrite rule).
And this actually works fine for www and the naked domain. But with subdomains weird stuff happens, eg, “foo.bar.com” would redirect to “https://bar.com/foo” and similar weird stuff.
I didn’t try putting it in the vhost – it might work better if it is there and comes before the other rewrite rules. Probably worth a shot.