I am sure this is a very common practice, but I was wondering what the cleanest way to Rewrite the following setup is:
Here is the folder structure at root (/):
/static (static.domain.com currently resolves here)
/test-static (test-static.domain.com currently resolves here)
/test-www (test-www.domain.com currently resolves here)
/www (www.domain.com currently resolves here)
The current domains under control are .com, .info, .name, .net and .org
Rewrite Behavoir intended:
domain.* -> www.domain.com
static.domain.* -> static.domain.com (except static.domain.com -> static.domain.com)
test-static.domain.* -> test-static.domain.com (except test-static.domain.com -> test-static.domain.com)
test-www.domain.* -> test-static.domain.com (except test-www.domain.com -> test-www.domain.com)
www.domain.* -> www.domain.com (except www.domain.com -> www.domain.com)
For that matter, *.domain.* should resolve to *.domain.com with the exception to *.domain.com. I also intend to keep everything after the host the same.
Example a request to http://domain.org/test.html becomes http://www.domain.com/test.html