All my pages except index.php do the 404 error

I would suggest trying this .htaccess code instead (and removing all the rules you’ve tried yourself):

Looking at the code:

  • RewriteBase doesn’t do what you think it does, and I would suggest removing it entirely.
  • The RewriteRule you do have only makes it so that URLs going from /public/something go to something. Which is fine if you want to prevent people from accessing the public folder directly, but doesn’t help ensure that accessing the URL /something.php will load the files from /public/something.php.