'htaccess rerouting multiple domains to one subfolder on the same level with a static value pass through

I know there are many .htaccess questions and aswers here and on the internet, but I can't find the answer in all the noise I am looking for. I am on a shared server. If you go to domain abc.com it access folder abc. IF you go to domain def.com it access folder def. What I want is if you go abc.com it must reroute the domain to folder def and send it a static value saying this is from abc... in that way I can have multiple domains access the same code in one folder and don't have to duplicate the code over and over again. Any ideas and solutions and comments will be extremely welcome and deeply appreciated. thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source