3

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

<a href="{siteUrl}/about#start">

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?

Becky Soll
  • 81
  • 1

1 Answers1

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:

<?php

return array(

    '*' => 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',
        )
    )
);
Brandon Kelly
  • 34,307
  • 2
  • 71
  • 137