This question already has an answer here:
Currently my site url is set up using mod_rewrite
and $_GET variables to load different content. Like this:mysite.com/subsite/var1/var2
I'd like to change that format to look like this:subsite.mysite.com/var1/var2
Is there an easy way to do this, or do I need to completely redesign my site's backend?
</div>
Use the following code, This will work for you which you want.
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^([a-zA-Z]).mysite.com\$ mysite.com/$1 [NC]
Something like this should work,
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^(www\.)?[^.]+\.mysite\.com.*$
RewriteRule (.*) subsite/$1 [L]