Htaccess:使用url值仅将404错误重定向到子文件夹以获取新的页面位置

I would like to place a htaccess file in the root of a site and have this htaccess file redirecting 404 errors to the subfolder mysite.com/old using the url value in the redirection so it becomes like mysite.com/old/articel1.html

In essence, I need a dynamic redirect from mysite.com/anyPage.html to mysite.com/old/anyPage.html but only if a 404 error happens.

I have looked into rewrites but I need Google to see that the url has changed permanently.

I have tried googling it and tested many examples but none worked like I need it to be.

Can you help? :-)

Thank you :-)

You can redirect with your .htacces file
This should looking like this

ErrorDocument 404 /old/anyPage.html 

And yes, this is not a 301, because you cant redirect 404 as 301 automaticly. Monitor your site with Google Console and add your redirect manually like this

RewriteEngine On
Redirect 301 /anyPage.html /old/anyPage.html