I'm trying to redirect multiple VirtualHosts without a preceeding "www." from one VirtualHost to another, like so:
<VirtualHost *:80> ServerName example.com ServerAlias example.org ServerAlias example.net # I either need some kind of Apache conditional here... Redirect 301 / http://www.example.com/ # ... or I need to substitute the Redirect *URL* with a variable # for the ServerName/ServerAlias </VirtualHost> <VirtualHost *:80> ServerName www.example.com </VirtualHost>
I could just create several VirtualHost containers and redirect each one individually, but I prefer not to repeat my code, if possible.
I'm using Apache 2.2 and I prefer not to use mod_rewrite to redirect. I'm fair with Apache, but far from an expert.