I currently have the following in a htaccess file which redirects certain requests to the requested domain\'s individual folder if the file does not exist in the root..
You can capture the needed host part with a RewriteCond and use it as %1
in the RewriteRule
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$
RewriteRule ^$ ASSETS/%1/index.php [L]
An alternative solution at the file system level (without htaccess) might be symbolic links. Instead of extracting the necessary host part, have symbolic links to the real directory, e.g.
- ASSETS -+-domain1.com (directory)
|
+-www.domain1.com -> domain1.com (symbolic link)
|
+-domain2.com (directory)
|
+-www.domain2.com -> domain2.com (symbolic link)