title: How do I redirect an Error 403 to root in .htaccess
body: <p>I am not very firm in Apache, so please excuse if the question might seem a bit obvious.
  I would like to redirect requests that would result in an Error 403 in specific directories to my webservers root by means of a .htaccess file.
  so <a href="https://thedomain.com/secretlair/" rel="nofollow noreferrer">https://thedomain.com/secretlair/</a> -> <a href="https://thedomain.com" rel="nofollow noreferrer">https://thedomain.com</a></p>
  
  <p>so far i used:</p>
  
  <pre><code>RewriteEngine on
  RewriteBase /
  RewriteRule (.*) https://thedomain.com/$1 [R=301,L]
  </code></pre>
  
  <p>which works but creates the problem of also redirecting
  <a href="https://thedomain.com/secretlair/thefile.txt" rel="nofollow noreferrer">https://thedomain.com/secretlair/thefile.txt</a> to <a href="https://thedomain.com/thefile.txt" rel="nofollow noreferrer">https://thedomain.com/thefile.txt</a></p>
  
  <p>what do I need to change to make this work?</p>
  
  <p>Thanks a lot!</p>