Force non-www With htaccess

In a earlier article I mentioned how to add the www. to your domain if users come through to your domain without it. Now I will explain how you can do the opposite and remove the www. from your domain if a visitors comes through with it or with any sub-domain.

Below is a snippet of the small bit of code you will need to perform this do.

Copy and paste this into your .htaccess file and it will remove any sub-domain from your domain name and redirect it to your main domain.
So if a visitor types in:
www.yourdomain.com
blog.yourdomain.com
forum.yourdomain.com