On my site writing www.anything.mydomain.it goes correctly to www.mydomain.it (not with the htacces but with * in the panel).
Now I need that a file, for example, www.anything.mydomain.it/photogallery/photo.jpg
goes to
www.mydomain.it/anything/photogallery/photo.jpg
I have written in htaccess
RewriteEngine on
RewriteRule ^http://www.(.*).mydomain.it/photogallery/(.*)$ $1/photogallery/$2 [L]
But it does not work!!