<p>I have a problem with multi-environment variables.
I have used this before on a site and it worked perfectly, but now I'm on a different host and it seems that my SERVER_NAME isn't checked.
Every setting I put in the '*' => array is working fine, but in the 'domain.com' => array, it doesn't work at all.
It's like the domain isn't checked upon and I have no clue what this could be as I use the exact same code that worked on my previous host for another site.
I also did a test to check if my SERVER_NAME is correct and it is.</p>

<p>Does anyone have an idea?</p>

<p><strong><em>Config file</em></strong></p>

<pre><code>&lt;?php

return array(
    '*' =&gt; array(
        'omitScriptNameInUrls'  =&gt; true,
        'devMode'               =&gt; true,
        'cache'                 =&gt; false
    ),

    'cmgg.buthost.com' =&gt; array( // Use basePath and baseUrl in asset sources
        'environmentVariables' =&gt; array(
            'basePath'              =&gt; '/home/butpanel/public_html/cmgg/public/',
            'baseUrl'               =&gt; 'http://cmgg.buthost.com/',
        ),

        'siteUrl' =&gt; array(
            'nl' =&gt; 'http://cmgg.buthost.com/nl/',
            'fr' =&gt; 'http://cmgg.buthost.com/fr/',
            'en' =&gt; 'http://cmgg.buthost.com/en/'
        ),
    ),
);
</code></pre>

CC BY-SA 3.0
2015-05-22T19:29:25.410Z
Can you share the config array you're using?
Brad Bell
CC BY-SA 3.0
2015-05-26T07:42:43.203Z
Edited the original post with the config as is.
Tom De Smet
CC BY-SA 3.0
2015-05-26T15:40:56.800Z
You've verified that `$_SERVER['SERVER_NAME']` is outputting `cmgg.buthost.com`?  Are you overriding http://buildwithcraft.com/docs/php-constants#craft-environment anywhere?
Brad Bell
CC BY-SA 3.0
2015-05-26T15:43:51.743Z
I triple checked the server name. Nothing wrong there. I didn't overwrite the craft environment constant either.
Tom De Smet
CC BY-SA 3.0
2015-05-26T15:45:27.587Z
Weird... your config file looks O.K. to me, FWIW.
Brad Bell
CC BY-SA 3.0
2015-05-26T15:51:13.087Z
Could it be server related? Some setting on my hosting? I've tried with *.buthost.com even with *.com and those didn't work either.
Tom De Smet
CC BY-SA 3.0
2015-05-26T15:53:08.277Z
Wildcards aren't supported there (http://buildwithcraft.com/docs/multi-environment-configs). Just try using `buthost.com` or `.com`.
Brad Bell
CC BY-SA 3.0
2015-05-26T15:59:12.030Z
Same issue. It just doesn't work. I don't get it. It's the same code I used before. I can only think that it's something on my hosting but I have no idea what. I'm on goDaddy hosting.
Tom De Smet
CC BY-SA 3.0
2015-05-26T16:00:43.523Z
GoDaddy!! If you want to send some CP/FTP creds over to support@buildwithcraft.com, we can take a stab at it.
Brad Bell
CC BY-SA 3.0
2015-05-27T12:35:21.097Z
I'm afraid my boss won't allow me to give out our credentials on our hosting. But the final site needs to be on the clients server so maybe it'll work there. Thanks for your help.
Tom De Smet
<config><multi-environment>
Multi-environment config SERVER_NAME not working
# Multi-environment config SERVER_NAME not working

(Asked by: username_0 on 2015-05-22)

I have a problem with multi-environment variables.
I have used this before on a site and it worked perfectly, but now I'm on a different host and it seems that my SERVER_NAME isn't checked.
Every setting I put in the '*' => array is working fine, but in the 'domain.com' => array, it doesn't work at all.
It's like the domain isn't checked upon and I have no clue what this could be as I use the exact same code that worked on my previous host for another site.
I also did a test to check if my SERVER_NAME is correct and it is.
Does anyone have an idea?
Config file
 array(
        'omitScriptNameInUrls'  => true,
        'devMode'               => true,
        'cache'                 => false
    ),

    'cmgg.buthost.com' => array( // Use basePath and baseUrl in asset sources
        'environmentVariables' => array(
            'basePath'              => '/home/butpanel/public_html/cmgg/public/',
            'baseUrl'               => 'http://cmgg.buthost.com/',
        ),

        'siteUrl' => array(
            'nl' => 'http://cmgg.buthost.com/nl/',
            'fr' => 'http://cmgg.buthost.com/fr/',
            'en' => 'http://cmgg.buthost.com/en/'
        ),
    ),
);

**Tags:** config, multi-environment

> **Comments:**
> **username_1**: Can you share the config array you're using?  
> **username_0**: Edited the original post with the config as is.  
> **username_1**: You've verified that `$_SERVER['SERVER_NAME']` is outputting `cmgg.buthost.com`?  Are you overriding http://buildwithcraft.com/docs/php-constants#craft-environment anywhere?  
> **username_0**: I triple checked the server name. Nothing wrong there. I didn't overwrite the craft environment constant either.  
> **username_1**: Weird... your config file looks O.K. to me, FWIW.  
> **username_0**: Could it be server related? Some setting on my hosting? I've tried with *.buthost.com even with *.com and those didn't work either.  
> **username_1**: Wildcards aren't supported there (http://buildwithcraft.com/docs/multi-environment-configs). Just try using `buthost.com` or `.com`.  
> **username_0**: Same issue. It just doesn't work. I don't get it. It's the same code I used before. I can only think that it's something on my hosting but I have no idea what. I'm on goDaddy hosting.  
> **username_1**: GoDaddy!! If you want to send some CP/FTP creds over to support@buildwithcraft.com, we can take a stab at it.  
> **username_0**: I'm afraid my boss won't allow me to give out our credentials on our hosting. But the final site needs to be on the clients server so maybe it'll work there. Thanks for your help.  

---

## 0 answers

