RewriteEngine on # If the hostname is not www.cafecamp.com... RewriteCond %{HTTP_HOST} !^www\.cafecamp\.com$ [NC] # ...and it matches this... RewriteCond %{HTTP_HOST} ^(([-_a-z0-9]+\.)+)cafecamp\.com$ [NC] # ...redirect the user and discard the original uri RewriteRule ^ http://www.cafecamp.com/camp.php?c=%1 [L,R=301]