NOTE: Using <VirtualHost>
parameter only.
How do I redirect a directory (say example.com/groups/
) to a sub-domain (say groups.example.com
), and also the www of that sub-domain (www.groups.example.com
) to the non-www URL of that sub-domain (groups.example.com
)?
Precisely (⇒ stands for 'should 301 redirect to'):
example.com/groups/
⇒ groups.example.com
www.groups.example.com
⇒ groups.example.com
I have read that using <VirtualHost>
is better than all those redirection rules that are usually used (i.e. that using redirection engine is pretty heavy on disk i/o). So, I would like to have the above problem solved using <VirtualHost>
in .htaccess / httpd.conf if possible. Thanks!