从另一个目录重写文件

I am trying to rewrite file in another directory but it gives an error.

Not Found

The requested URL /admin/posts/edit/1 was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

/public_html
    /admin
         /.htaccess
         /posts

I need to do this www.example.com/admin/posts/edit/1 from this www.example.com/admin/posts/edit.php?id=1

I have this code in my .htaccess:

RewriteEngine On

RewriteRule ^edit/([0-9a-zA-Z]+) /admin/posts/edit.php?id=$1 [NC,L]

Create a file /admin/.htaccess and place this rule:

Options -MultiViews
RewriteEngine On
RewriteBase /admin/

RewriteRule ^posts/edit/([0-9a-z]+)/?$ posts/edit.php?id=$1 [NC,L,QSA]