<p>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.</p>

<p>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.</p>

<p>Let's say you have three environments:</p>

<ul>
<li>website.com</li>
<li>dev.website.com</li>
<li>localwebsite.dev</li>
</ul>

<p>Unless you are overriding the <code>CRAFT_ENVIRONMENT</code> variable in your <code>index.php</code> 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.</p>

<p>Here's an abbreviated example multi-env settings array:</p>

<pre><code>array(
    '*' =&gt; array(
        'environmentVariables' =&gt; array(
            'siteUrl'  =&gt; 'website.com',
        ),
    ),
    'dev' =&gt; array(
        'environmentVariables' =&gt; array(
            'siteUrl'  =&gt; '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`
</code></pre>

<p>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.</p>

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

<p>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.</p>

CC BY-SA 3.0
2015-08-23T00:57:24.027Z
2015-08-23T00:57:24.027Z
Ben Parizek
<p>I'm using the Barrel Stength <a href="https://github.com/BarrelStrength/Craft-Multi-Environment-Config" rel="nofollow">Craft-Multi-Environment-Config</a> to have a dev and live site configuration. </p>

<p>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.</p>

<p>I've also changed the Assets path and URL in the admin to</p>

<pre><code>Path: {basePath}../public/my_assets_folder
URL: {siteUrl}my_assets_folder/
</code></pre>

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

<p>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?</p>

CC BY-SA 3.0
2015-04-23T07:56:19.560Z
Try clearing the cache?
Jason McCallister
CC BY-SA 3.0
2015-04-23T16:53:25.063Z
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
<config><multi-environment>
Craft-Multi-Environment-Config redirects to dev url on admin login
# Craft-Multi-Environment-Config redirects to dev url on admin login

(Asked by: username_0 on 2015-04-23)

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?

**Tags:** config, multi-environment
> **Comments:**
> **username_1**: Try clearing the cache?  
> **username_2**: 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.  

---

## 1 answers

### Answer by username_3 on 2015-08-23. Score: 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.


---

