I really tried tons of methods but i'm not successful. I want a .Htaccess code to do the following :
I want to rename this : http://www.mydomain.com/media --> http://media.mydomain.com
So, By example instead of calling this : http://www.mydomain.com/media/XXX/picture.jpg i will call : http://media.mydomain.com/XXX/picture.jpg
Thank you
Make sure rewrite_module is loaded, something like;
Then add the following (to your .htaccess):
The Cond will only match www.mydomain.com. The Rule then will split the URL into 2 using the first '/' (which will be included in $2), rewrite and redirect.
If you want the opposite (see Roger's comment) and without redirecting the user
Also, see here: http://httpd.apache.org/docs/1.3/misc/rewriteguide.html
It's gonna be like this: