I recently setup a staging site on our server's subdomain. Somehow Google managed to crawl the pages. Now we are ready to transfer the files to the main domain and delete the files on the subdomain. This is a big problem for our SEO which will make the pages on the root domain appear to be duplicates of the indexed pages on the subdomain. All paths on the subdomain is exactly the same with ones on the root domain, only the host part is different.
Here are some of the many different path structures of the site:
http://beta.mysite.com/ --> http://www.mysite.com http://beta.mysite.com/index.php?class=xxx&func=xxxx --> http://wwww.mysite.com/index.php?class=xxx&func=xxxx http://beta.mysite.com/class/xxx/func/xxx --> http://www.mysite.com/class/xxx/func/xxx http://beta.mysite.com/seo-text-here-class-xxx-func-xxx --> http://www.mysite.com/seo-text-here-class-xxx-func-xxx http://beta.mysite.com/xxx-xxx.html --> http://www.mysite.com/xxx-xxx.html
As you can see only the host part changed, everything else remains as it is.
QUESTION: Is it possible to redirect requests on the subdomain to do a SEO friendly redirect to the actual files on the root domain without having to explicitly write each rule for different path structures?
NOTE: The redirection should be transparent to users which means they should see that the page actually redirects to the main site.