<p>Multi-environment configs <strong>require</strong> you to create a <code>'*'</code> config array, even if it’s empty because there aren’t any config settings that you need to set globally. Simply having that <code>'*'</code> array is how Craft is able to determine that this is a multi-environment config, as opposed to <code>'.dev'</code> and <code>'.org'</code> just being normal config settings. (See the warning on <a href="http://buildwithcraft.com/docs/multi-environment-configs" rel="noreferrer">http://buildwithcraft.com/docs/multi-environment-configs</a>.)</p>

<p>So this should work for you:</p>

<pre class="lang-php prettyprint-override"><code>&lt;?php

return array(

    '*' =&gt; array(
        // It's OK if this is empty, as long as it's here.
    ),

    '.dev' =&gt; array(
        'environmentVariables' =&gt; array(
            'siteUrl'  =&gt; 'http://mysite.dev:8888',
        )
    ),

    '.org' =&gt; array(
        'environmentVariables' =&gt; array(
            'siteUrl'  =&gt; 'http://mysite.org',
        )
    )
);
</code></pre>

CC BY-SA 3.0
2014-09-08T17:27:27.837Z
2014-09-08T17:27:27.837Z
Brandon Kelly
<p>I've got a multi-environment setup working well for my database - that was easy to setup and i've had no issues getting it to work. Now i'm trying to set the siteUrl as a multi-config variable and no luck. I have this in general.php</p>

<pre><code>return array(

  '.dev' =&gt; array(
    'environmentVariables' =&gt; array(
      'siteUrl'  =&gt; 'http://mysite.dev:8888',
    )
  ),
  '.org' =&gt; array(
    'environmentVariables' =&gt; array(
      'siteUrl'  =&gt; 'http://mysite.org',
    )
  )

);
</code></pre>

<p>and i've set "Site URL" in settings > General Settings to {siteUrl}</p>

<p>the problem is, now when I load the front-end of my site, it is outputting my links with {siteURL} written out as the actual links, eg</p>

<pre><code>&lt;a href="{siteUrl}/about#start"&gt;
</code></pre>

<p>All the documentation and posts I can find seem to imply that this is all I should have to do. Any idea what's missing?</p>

CC BY-SA 3.0
2014-09-08T16:50:04.760Z
possible duplicate of [Environment Variable siteURL ignored](http://craftcms.stackexchange.com/questions/1771/environment-variable-siteurl-ignored)
Brad Bell
<url><multi-environment><siteurl>
multi-environment config for {siteURL} not working
# multi-environment config for {siteURL} not working

(Asked by: username_0 on 2014-09-08)

I've got a multi-environment setup working well for my database - that was easy to setup and i've had no issues getting it to work. Now i'm trying to set the siteUrl as a multi-config variable and no luck. I have this in general.php
return array(

  '.dev' => array(
    'environmentVariables' => array(
      'siteUrl'  => 'http://mysite.dev:8888',
    )
  ),
  '.org' => array(
    'environmentVariables' => array(
      'siteUrl'  => 'http://mysite.org',
    )
  )

);

and i've set "Site URL" in settings > General Settings to {siteUrl}
the problem is, now when I load the front-end of my site, it is outputting my links with {siteURL} written out as the actual links, eg


All the documentation and posts I can find seem to imply that this is all I should have to do. Any idea what's missing?

**Tags:** url, multi-environment, siteurl

> **Comments:**
> **username_1**: possible duplicate of [Environment Variable siteURL ignored](http://craftcms.stackexchange.com/questions/1771/environment-variable-siteurl-ignored)  

---

## 1 answers

### Answer by username_2 on 2014-09-08. Score: 5

Multi-environment configs require you to create a '*' config array, even if it’s empty because there aren’t any config settings that you need to set globally. Simply having that '*' array is how Craft is able to determine that this is a multi-environment config, as opposed to '.dev' and '.org' just being normal config settings. (See the warning on http://buildwithcraft.com/docs/multi-environment-configs.)
So this should work for you:
 array(
        // It's OK if this is empty, as long as it's here.
    ),

    '.dev' => array(
        'environmentVariables' => array(
            'siteUrl'  => 'http://mysite.dev:8888',
        )
    ),

    '.org' => array(
        'environmentVariables' => array(
            'siteUrl'  => 'http://mysite.org',
        )
    )
);


---

