I am using Apache, and would like to redirect all subdomain and non www addresses to the www version using Virtual Hosts.
The only exception to this rule is that I want media.domain.com to point to the same location as www.domain.com because I want a different, cookieless domain for images and video to be located on.. (speed).
The code below is not however working. How would one go about achieving this?
<VirtualHost *:80>
ServerName www.domain.com
ServerAlias www.domain.com media.domain.com
ServerAdmin [email protected]
DocumentRoot /srv/www/domain.com
</VirtualHost>
<VirtualHost *:80>
ServerName domain.com
ServerAlias domain.com
Redirect permanent / http://www.domain.com/
</VirtualHost>