Is it possible to setup multiple site.php files and have c5 switch between them depending on the incoming domain?
Permalink
Hi There,
We have local MAMP, DEV Server and LIVE Server environments and I was wondering if there's a way to have c5 switch between multiple site.php files depending on the incoming domain?
Can you add php to site.php to do this? I had a go but all I got was a blank page - totally could've been the code I added though.
Has anyone done this?
Cheers
Ben
We have local MAMP, DEV Server and LIVE Server environments and I was wondering if there's a way to have c5 switch between multiple site.php files depending on the incoming domain?
Can you add php to site.php to do this? I had a go but all I got was a blank page - totally could've been the code I added though.
Has anyone done this?
Cheers
Ben
Thanks heaps for this - I was trying something similar but was using:
To try and load the file (don't know much php sorry).
What function would you use to load the actual file?
if ($_SERVER['HTTP_HOST'] == 'domain-one') { $this->inc('siteDEV.php');
To try and load the file (don't know much php sorry).
What function would you use to load the actual file?
So used 'include' which works
Thanks!
Also for my ref, this works by passing a variable about the environment from the Apache virtual host to your site.php file:http://jeremeclaussen.com/index.php?cID=205&bID=296&arHandl...
Set your local to be the default so you don't have to change MAMP's (or WAMP's) virtual host file - and don't forget to reload apache after adding the variable to the virtual host file.
<?php if ($_SERVER['HTTP_HOST'] == 'domain-dev') { include('siteMAMP.php'); } else if ($_SERVER['HTTP_HOST'] == 'domain-live') { include('siteDEV.php'); } else { }
Thanks!
Also for my ref, this works by passing a variable about the environment from the Apache virtual host to your site.php file:http://jeremeclaussen.com/index.php?cID=205&bID=296&arHandl...
Set your local to be the default so you don't have to change MAMP's (or WAMP's) virtual host file - and don't forget to reload apache after adding the variable to the virtual host file.