I developed a new site to display my demos. I could simply htaccess 301 my entire site. But then every visitor would be confused they didn’t land on their expected page. But that’s best for google. I could meta refresh after 5 seconds and say the site has moved, so good for visitors, but meta is bad for seo. I could php 301 it using the same ideas.
If you switched domain names, and you spent the last 6 years building seo for your old domain, how would you 301 redirect to your new domain? Remembering that I also want to inform visitors that I changed locations.