1

I'm using the Barrel Stength Craft-Multi-Environment-Config to have a dev and live site configuration.

On my local dev install, under Settings > General I've changed to Site URL to {siteURL}. On logging into the admin, I'm redirected to the dev url.

I've also changed the Assets path and URL in the admin to

Path: {basePath}../public/my_assets_folder
URL: {siteUrl}my_assets_folder/

Images on the live frontend aren't displaying - they're served by HTTPS. Dev site is fine.

DB settings are working as expected. I just can't login to the live admin and the images aren't displaying on the dev frontend. What am I missing?

  • 1
    Try clearing the cache? – Jason McCallister Apr 23 '15 at 7:56
  • 1
    I think you're going to need to share your config files... it's going to be hard to debug what's going on without them. – Brad Bell Apr 23 '15 at 16:53
3

If the environment that you are working in is behaving like the settings that you have set for another environment, it's likely that the settings from that other environment are the ones that are being read by Craft.

The most common situation where I've seen this take place is based on the way that the Craft multi-environment config matches patterns for each environment you are in.

Let's say you have three environments:

  • website.com
  • dev.website.com
  • localwebsite.dev

Unless you are overriding the CRAFT_ENVIRONMENT variable in your index.php file, you may have a situation the keys of the multi-environment settings array match the pattern of the URL from the environment you are in.

Here's an abbreviated example multi-env settings array:

array(
    '*' => array(
        'environmentVariables' => array(
            'siteUrl'  => 'website.com',
        ),
    ),
    'dev' => array(
        'environmentVariables' => array(
            'siteUrl'  => 'dev.website.com',
        ),
    ),
);

// The Barrel Strength Multi-env config checks for an
// additional local config here.  In our example, that 
// would be for the environment `localwebsite.dev`

In this example, 2 of your 3 environments are going to trigger the configuration for your dev site, and none are going to trigger the configuration for your local setup.

Both dev.website.com and localwebsite.dev will trigger the settings in the dev configuration in the array as Craft takes the first configuration that matches the pattern in the URL, and the word dev will match both of those environment URLs.

As the other comments have noted on the primary post, this is really just guesswork until we see the specific config settings you are using. I've tried to approach my answer as one that at least applies to a similar situation to the issue described even if it turns out that it doesn't help resolve the immediate question.

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.