使用htaccess重写URL

I have a website as a side hobby.

I purchase a custom script from a developer. That script is designed to be run on the main domain. like www.example.com

This is because of the script using require_once and include_path function to call files within the script. For example /functions.php or /admin.php

So if I configure it on the main domain it works but on the subdomain, it gives 403 Forbidden error because of the nonexistence of URLs.

I mean for subdomain the directories inside it should be changed to subdomain.example.com/functions.php or subdomain.example.com/admin.php.

Here is the problem there are more than 100+ pages and it would be quite hard to change it one by one for me.

I am looking if I can do it using .htacess rewrite module.

Is it possible if on page load the directories inside the files can be altered?