Redirecting a sub domain with htaccess

I have not needed to redirect sub domains before but after installing wordpress 3 for a client (and activating the multiple blogs option) the client wanted one of their sub domains to always point to their home page instead of the standard Registration has been disabled text.

To do this all you need to do it edit the .htaccess file on the server (if your running apache) with the following code:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^subdomain.yourdomain.co.uk$ [NC]
RewriteRule (.*) http://www.yourdomain.co.uk/$1 [R=301,L]

Of course replace subdomain.yourdomain.co.uk with your own subdomain and main domain name.

If anyone has used any wordpress plugins to achieve this then please drop us a comment if they have worked well as its not always possible of course for people to edit their .htaccess file.