Virtual Host redirect for non existen subdomains to www

view story

http://serverfault.com – I know there are a number of different ways to redirect using apache although I wanted to check if this is the correct way of doing it via virtual host? <VirtualHost *:80> ServerName example.com ServerAlias www.example.com DocumentRoot /var/www/example/public <Directory "/var/www/example/public"> Options +FollowSymlinks # Prevent Direct Access to files <FilesMatch "\.(tpl|ini|log)"> Order deny,allow Deny from all </FilesMatch> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} (HowTos)