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)?

  • Oyvind, please learn how to format code blocks with markdown. – carlcs Jul 16 '14 at 10:41
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).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.