I just discovered this neat little trick. I had to close down a subdomain as the CMS I was using was no longer being supported, and I could not afford a coder to fix my problems. So I places this in the .htaccess file in the root of the old subdomain:
RewriteEngine on
RewriteRule ^(.*)$ / [L,R=301]
Previously I was attempted to use the standard Redicect 301, but this did not work, as the file URL’s were redirected, causing 404 page not found errors. This code sorts it all out.