I work at a firm that offers webhosting, and I want to host my site there. I don't work near the server so I won't get to configure it because it's somebody else's job. I will tell the administrator to create a virtual host for :
ServerName www.domain.com
ServerAlias *.domain.com
And I will not go to tell him to add me a new virtual host for every subdomain I want, so that's why I need a way to redirect using any means possible :D.
I've created a script using javascript and php to redirect every <subdomain>.domain.com to www.domain.com/<subdomain> but this doesn't work if i get <subdomain>.domain.com/image.jpg .
Is there a way using .htaccess file to get all the <subdomain>.domain.com/<file> from www.domain.com/<subdomain>/<file> and for the URL from the browser not having to change?