I'm using the configuration below to use vhost_alias_module to more easily manage my hosted setup. I want sites to be structured like the following /sites/domain.com/w/w/w/ which with the configuration below works fine. However, if I attempt to access domain.com instead of www.domain.com this falls apart. How do I fix this?
Update: I want request for domain.com to automatically be directed to www.domain.com. It would be fine if this required a 403 redirect (I think that would be preferred from a SEO perspective) .
LoadModule vhost_alias_module /usr/lib/apache2/modules/mod_vhost_alias.so <VirtualHost *:80> ServerAdmin email@example.com DocumentRoot /sites/ <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /sites/>; Options Indexes FollowSymLinks MultiViews ExecCGI AllowOverride All Order allow,deny allow from all </Directory> UseCanonicalName Off VirtualDocumentRoot /sites/%2+/%1.1/%1.2/%1.3+ </VirtualHost>