I don't seem to be getting anywhere with this. I've searched google, but all I can find is an endless pool of sub-domain to domain redirects, nothing with sub-domain to sub-domain. Scenario: I run a website that was, as of yesterday, using a .com domain. I am now switching it to a .net domain. I host some sub-sites on it that are accessible via sub-domains and I am trying to figure out how I can automatically redirect them to the new domain. For example someone would enter http://sub.domain.com and it should go to http://sub.domain.net Also, it's possible there will be folders and filenames at the end, for example: http://sub.domain.com/dir/file.txt should go to http://sub.domain.net/dir/file.txt For the domain by itself I already have the following, which works, but I'm at a loss for trying to redirect the sub-domains as well: Options +FollowSymLinks RewriteEngine on RewriteRule (.*) http://new-domain.net/$1 [R=301,L] Code (markup): Any insight is appreciated.
if you forwarded the whole domain wont it work? cause user to host a website on a domain then moved it to a subdomain then forwarded the domain to that subdomain so when the user comes through google to a certain domain link it forwards him to the subdomain with the same link after the domain like from example.com/blog/post to sub.example.com/blog/post, not sure if it helps but its worth a try.