<VirtualHost *:80>
ServerName yoursite.com
DocumentRoot /path/to/docroot
ErrorLog /path/to/logs/yoursite
RewriteEngine On
RewriteCond %{HTTP_HOST} !^yoursite\.com$ [NC] # Has subdomain
RewriteCond %{HTTP_HOST} !^www\.yoursite\.com$ [NC] # Not www
RewriteRule ^(.*)\.yoursite\.com$ /profile/$1 [PT,L] # Silent redirect
RewriteCond %{HTTP_HOST} !^yoursite\.com$ [NC] # Has subdomain
RewriteCond %{HTTP_HOST} !^www\.yoursite\.com$ [NC] # Not www
RewriteRule ^(.*)\.yoursite\.com(.*) yoursite\.com/$2 [L] # Redirect if not profile
</VirtualHost>
It looks like you're new here. If you want to get involved, click one of these buttons!