Possible Duplicates
how can I use mod rewrite to redirect a folder to a subdomain ...
Apache rewrite based on subdomain (backwards)
I have catch all rules set up and a subdomain working fine.
However it's still possible to get to a part of my site from http://example.com/subdomain rather than http://subdomain.example.com/
How would I force a permanent redirect?
I'm assuming it's something like:
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
# (rule to see if i am inside subdomain folder)
RewriteRule ^(.*)$ http://www.subdomain.example.com/$1 [R=301,L]