Hello,
Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.
Those 404 errors are usually caused by hackers and bots checking for vulnerabilities in websites (since .env files are used in NodeJS web apps to store private information).
You shouldn’t worry about it and it is not even necessary to create a redirect since Google won’t look for them (and then won’t try to index them and get an error) but if you still want to add a redirection, you could add one like this:

Looking forward to helping you. Thank you.
Hello,
Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.
If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.
Thank you.