Site icon Hip-Hop Website Design and Development

Change htaccess to redirect to index.php in subfolder

How can I change the WordPress root folder .htaccess file to redirect URLs with a specific subfolder to its own index.php and give the path data as a URL variable to the index.php?

https://example.com/subfolder/img.png

redirect to:

https://example.com/subfolder/index.php?path=img.png

all other redirects should work like WordPress expects them to.