Apache: How to Redirect All Root Domain Traffic to Subdomain

Problem: Traffic comes to http://krevatas.net/{something} but they really need to go to http://kostas.krevatas.net/{something}.

Solution: 301 Redirect via Apache with mod_rewrite.

Simple easy addition to your httpd.conf or .htaccess, I placed mine right above my wordpress mod_rewrite rules. If you are using .htaccess just dump it in that file above the wordpress redirect, if you having your rewrite rules in your httpd.conf then it needs to go inside the container:

What we mean by these lines:

  1. Everything that does not start with kostas.krevatas.net{something}
  2. Should redirect to kostas.krevatas.net/{something}

With some credits to http://aknosis.com