apache mod_rewrite scenario subdomain capturing from the http_host and passing it as subdomain to other url while rewriting it
Redirect, Change URLs or Redirect HTTP to HTTPS in Apache - Everything You Ever Wanted to Know About mod_rewrite Rules but Were Afraid to Ask