<VirtualHost *:80>
ServerAdmin podcast@chrysalis.com
DocumentRoot /data/www/chrysalis/audioagain/www/
ServerName audio-again.com
ServerAlias *.audio-again.com audio-again.co.uk *.audio-again.co.uk *.audioagain.co.uk audioagain.co.uk *.audioagain.com audioagain.com
ErrorLog /data/logs/audioagain-error_log
CustomLog /data/logs/audioagain-access_log common
RewriteEngine on
RewriteMap lowercase int:tolower
# check the hostname is right so that the RewriteRule works
RewriteCond ${lowercase:%{SERVER_NAME}} ^[a-z-]+\.audio[-]?again\.co[m|(\.uk)]$
# concatenate the virtual host name onto the start of the URI
# the [C] means do the next rewrite on the result of this one
RewriteRule ^(.+) ${lowercase:%{SERVER_NAME}}$1 [C]
# now create the real file name
RewriteRule ^([a-z-]+)\.audio[-]?again\.co[m|(\.uk)]/(.*) /data/www/chrysalis/audioagain/$1/$2
ErrorDocument 404 ../index.php
</VirtualHost>