title: Redirecting 404 error with .htaccess via 301 for SEO etc
body: <p>I couldn't find a straight answer to my question and need to know it from the real experts.</p>
  
  <p>I had a website which urls were generated by Joomla. I believe that tons of urls are around in the search engines and I really don't know which of them all. A 302 redirect would be an option, but I can't say which urls need to be redirected.</p>
  
  <p>The only thing I know that all the urls were generated by a sef404 script, it's a SEO script for Joomla.</p>
  
  <p>My question, how can I make sure that all the orphan urls on google and other search engines are delivered correctly with a .htaccess file?</p>
  
  <p><strong>How do I 301 redirect all 404 pages to the homepage (root document)</strong></p>
  
  <p>At the moment I use a custom 404.html error file, but there are too many files and will give a rollercoaster of custom 404 error pages</p>