Redirecting subdomains with mod_rewrite
August 19, 2005 4:01 PM Subscribe
A subdomain redirection question (any mod_rewrite experts?)
posted by subclub to Computers & Internet (12 answers total)
So let's say that I'm setting up my new site, sports.com. Here is what I'd like to do:
When someone visits http://baseball.sports.com, I would like them to be redirected to http://sports.com/index.php?id=baseball (but transparently, so http://baseball.sports.com still appears in their browser). I would like to do this with several subdomains, but I don't need to handle *.sports.com (my webhost doesn't support wildcarded DNS entries anyway).
I realize I could fake this with frames, but that seems kind of lame. After wading through tons of .htaccess & mod_rewrite info, I'm more confused than ever. Can anyone help me pull this off?