Forum Moderators: phranque
I would very much like to parse different files on the fly depending upon the environment variable set. my current .htaccess setting is something along the lines of
SetEnvIfNoCase Referer "^http:\/\/(.[^\/]*\.)?domain1.com" SITE=Site1
SetEnvIfNoCase Referer "^http:\/\/(.[^\/]*\.)domain2.com" SITE=Site2
at the moment, I have a default php file which looks like this:
if($_SERVER['SITE'] == 'Site1') include('site1/'.$_SERVER['REQUEST_URI']);
elseif($_SERVER['SITE'] == 'Site2') include('site2/'.$_SERVER['REQUEST_URI']);
else include('index.php');
That's a simplified version of what I'm doing. However, I really need htaccess to do this because I need different <Directory> rules for the directories 'site1' and 'site2' to apply and a php include won't trigger apache to apply them. Ideally a mod_rewrite could do it without a redirect, but I have no idea how to do it....
Is this possible at all?
Thanks for any help