It rarely happens that you have to redirect an entire site and when it does you should think twice about its SEO consequences, but here are instructions on how to get it done
HTAccess is an Apache configuration file that can be used to tell your server to redirect directories, files, domains, provide 404, 403, 500 sites or add expiration dates to your files. A lot of your site can be directly configured in this tiny file and it usually one of the most important things to learn for new webmasters.
Redirecting An Entire Site
Easiest: (redirects all paths, all incoming urls to the next, exactly as is)
Redirect 301 / http://domain.com
Redirect entire paths:
RedirectMatch 301 ^/(.*) http://domain.com/$1
RedirectMatch 301 ^/community/ http://domain.com/$1
RedirectMatch 301 ^/portal/ http://domain.com/portal/$1
Why It Is Never A Good Idea To Redirect An Established (Larger) Site
Let’s say you’ve been running a successful site on domainA.net bringing in thousands every month and now you managed to acquire the domainA.com – now the question is, are you going to redirect the .net to the .com or the other way around? The latter option, redirecting the .com to the .net is usually better and here’s why:
3 Months And More: No matter what Google tells you, it will take time to fully acknowledge your transfer. On any site (even larger sites) it can take a full cycle and always more than 3 months until you have all your rankings back. I had a lot of competition in some niches back in the day. For some reasons beyond me, the competition decided it was a good idea to “start fresh” with a new domain. Bad move! They all dropped out of the rankings and were never heard of again, because they then lost the willpower to get their rankings back and neglected their daily duties as a webmaster. Redirecting an established site is always a poor move, always.
Big rebrand: Want another example? Some big brand tried re-branding their high quality .com website using the .co domains, because they thought it was trendy and cool. Result: It cost them millions in revenue.
When It Is A Good Idea To Redirect An Entire Site: Smaller Sites
Let’s say you have an established site xyz.com and you recently acquired a smaller site. Now it makes perfect sense to redirect the smaller site and add it to your existing site. Usually, you would use subdomains or at least subfolders for this. E.g. if you acquired a marketplace, you could redirect it to marketplace.yxz.com