0

I'm working on a project that only has one server to work with. That means the production and development server are the same and development is a sub domain (dev.example.com). In the past when I've run into this it hasn't been an issue to use the Focus Labs multi environment bootstrap setup. I just put both system folders above webroot:

  • Pulblic_html
    • www.example.com
      • system
    • dev.example.com
      • system

However on this project we want to put the system folder above webroot:

  • system
  • Public_html
    • www.example.com

That presents a problem when putting dev on the same server. They would both point to the same folder above webroot. Is there a way to have the bootstrap file look for a different system folder above webroot?

  • system
  • system_dev
  • public_html
    • www.example.com
    • dev.example.com

I trie hacking around the config file, but didn't have any luck. Anyone do this? It seems like a pretty common scenario people would encounter.

1

Another option, though not ideal, would be to put a conditional in the index.php and admin.php files:

switch ($_SERVER['HTTP_HOST']) {
    case "www.example.com" :
        $system_path = "../system";
    break;

    case "dev.example.com" :
        $system_path = "../system_dev";
    break;

    default :
        $system_path = "../system";
    break;
}
1
  • I figured something like this would be possible. I'll check with the hosting company first to see what is possible. Then give this a shot if that doesn't work out. Thank you. – Doug May 1 '14 at 19:27
3

Ultimately it comes down to your hosting company and how much control they have over mapping the domain's web root.

I'd ask your host if you can re-map the production domain to point to /public_html/public. Same with your development domain, have it mapped to dev_html/public. So your setup will look like this:

  • dev_html
    • system
    • public
  • public_html
    • system
    • public

Or, another option would be:

  • public_html
    • www.example.com
      • public
      • system
    • dev.example.com
      • public
      • system

That way you can keep your above-root assets separate and tidy.

2
  • It is Bluehost, I'll check with them. Thanks. – Doug May 1 '14 at 19:26
  • I have done it using the second option quite often. Either that or I set up a subdomain of one of my own domain names and use a different server. – foamcow May 2 '14 at 12:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.