4

When I load Site > CP Home > General Configuration I see the right values in the field: http://www.example.com for an instant. When the page fully loads it will change to http://dev.example.com. The same happens in my local build. It too initially is correct (http://local.example.com) but then switches to http://dev.example.com an instant after the page loads.

Most everything works on these sites. The only issue (other than it being very strange to see) may be Lamplighter. That isn't working and they say the value in that field must match the actual page URL otherwise it will not work.

I read on the EE bug tracker that EE stores some config variables in the database. Does the base_url value get stored in the database? I looked but could not find anything.

I was using Focus Labs multi environment config, but even after reverting back to the stock EE config, index, admin, and database files it is doing it. That leads me to believe the database is storing the information. I have imported and exported the database from Dev to Production and local.

2
  • could the site_url be stored in the database and it isn't letting the config files override it?
    – Doug
    Jul 2, 2014 at 20:21
  • If any if the answers helped you, please mark it as so. Jul 6, 2014 at 0:34

2 Answers 2

4

I make a few changes to the Master Config in my Base EE install. I made some pull requests to the core, but I am not sure if they were approved. I actually change my environment to the follow, it makes life much simpler with domains.

Basically the following code strips the WWW from the URL and ensure you only have to define the domain once. Real simple tweak that goes a long way. I am not totally sure if I understand your error, but I use this to do something similar.

if ( ! defined('ENV'))
{
    switch (str_replace('www.', '', $_SERVER['HTTP_HOST']))
    {
        case 'domain.com' :
            define('ENV', 'prod');
            define('ENV_FULL', 'Production');
            define('ENV_DEBUG', FALSE);
        break;

        case 'dev.domain.com' :
            define('ENV', 'dev');
            define('ENV_FULL', 'Development');
            define('ENV_DEBUG', FALSE);
        break;

        default :
            define('ENV', 'local');
            define('ENV_FULL', 'Local');
            define('ENV_DEBUG', TRUE);
        break;
    }
}
2
  • The main issue is in the URL and Themes URL in the production CP setting I see dev.example.com and not example.com.
    – Doug
    Dec 21, 2012 at 21:14
  • This is really useful Justin. Nice tip! Sep 4, 2013 at 14:38
2

This doesn't directly answer your question about Master Config, but you might try giving the REElocate plugin a try: http://devot-ee.com/add-ons/reelocate

It gives you the ability to easily do a find and replace for URL and Server Path values, which can ease the pain of moving between environments and works wonders for issues like the one you're describing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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