<p>I don't know if this is relevant for the Email Service, but you should use the (new since Craft 2.0) <a href="http://buildwithcraft.com/docs/config-settings#siteUrl" rel="nofollow noreferrer"><code>siteUrl</code></a> config setting (<a href="https://craftcms.stackexchange.com/questions/920/what-s-the-recommended-way-to-set-the-site-url/921#921">recommended</a>):</p>

<pre><code>'.dev' =&gt; array(
    'siteUrl' =&gt; 'http://example.dev/',
    'environmentVariables' =&gt; array(
        'siteUrl' =&gt; 'http://example.dev/',
        'serverPath' =&gt; '/Users/foo/'
    ),
),

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

// ...
</code></pre>

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

CC BY-SA 3.0
2014-07-16T11:14:38.607Z
2014-07-16T15:20:14.550Z
2017-04-13T12:50:59.930Z
carlcs
<p>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).</p>

<p>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.</p>

<p>This is how I have setup my general.php:</p>

<pre><code>'.dev' =&gt; array(
    'devMode' =&gt; true,
    'environmentVariables' =&gt; array(
        'siteUrl' =&gt; 'http://craft.dev/',
        'basePath' =&gt; '/Users/foo/'
    )
),

'mysite.com' =&gt; array(
    'cooldownDuration' =&gt; 0,
    'environmentVariables' =&gt; array(
        'siteUrl' =&gt; 'http://mysite.com/',
        'basePath' =&gt; '/home/mysite_ftp/www/'
    )
)
</code></pre>

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

CC BY-SA 3.0
2014-07-16T10:41:56.900Z
Oyvind, please learn how to format code blocks with markdown.
carlcs
<database>
User activation link issue
# User activation link issue

(Asked by: username_0 on 2014-07-16)

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

**Tags:** database

> **Comments:**
> **username_1**: Oyvind, please learn how to format code blocks with markdown.  

---

## 1 answers

### Answer by username_1 on 2014-07-16. Score: 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).


---

