2

I have a local craft.dev server running MAMP, and a public server (mysite.com), that both access the same database (on the public server). I then have some environmentvariables in general.php that makes this work smoothly (setting siteUrl and basePath for the different environments).

However, this doesnt seem to work if I access my public servers Craft CP, and add a new user. The activation link won't work on the users end. If I check Craft CPs General Settings it says the siteurl is craft.dev (even when I'm on mysite.com/admin), so that might be the problem, I guess.

This is how I have setup my general.php:

'.dev' => array(
    'devMode' => true,
    'environmentVariables' => array(
        'siteUrl' => 'http://craft.dev/',
        'basePath' => '/Users/foo/'
    )
),

'mysite.com' => array(
    'cooldownDuration' => 0,
    'environmentVariables' => array(
        'siteUrl' => 'http://mysite.com/',
        'basePath' => '/home/mysite_ftp/www/'
    )
)

Would it make sense if I visit mysite.com/admin, change the CPs general settings siteurl to mysite.com/, add the user, and then change siteurl back to craft.dev? Would the activation link work on the users end then? And, can I do any harm by changing this siteurl-setting (just to give it a try)?

carlcs
  • 36,220
  • 5
  • 62
  • 139
osh
  • 605
  • 2
  • 7
  • 16

1 Answers1

2

I don't know if this is relevant for the Email Service, but you should use the (new since Craft 2.0) siteUrl config setting (recommended):

'.dev' => array(
    'siteUrl' => 'http://example.dev/',
    'environmentVariables' => array(
        'siteUrl' => 'http://example.dev/',
        'serverPath' => '/Users/foo/'
    ),
),

'mysite.com' => array(
    'siteUrl' => 'http://example.com/',
    'environmentVariables' => array(
        'siteUrl' => 'http://example.com/',
        'serverPath' => '/home/mysite_ftp/www/'
    ),
),

// ...

Or you set the Site URL setting in Settings → General to {siteUrl} (the custom siteUrl variable you set in environmentVariables).

carlcs
  • 36,220
  • 5
  • 62
  • 139