<p>Did you <a href="http://buildwithcraft.com/help/localization" rel="nofollow">configure siteUrl</a> in <code>general.php</code>?</p>

<pre><code>return array(
    // ...
    'siteUrl' =&gt; array(
        'en' =&gt; 'http://example.com/en/',
        'de' =&gt; 'http://example.com/de/',
    ),
);
</code></pre>

CC BY-SA 3.0
2014-07-11T17:16:40.423Z
Yes. Also in the index.php. I use a multi-environment config file and the site is multi-language.
Johannes Lamers
CC BY-SA 3.0
2014-07-14T23:56:59.353Z
@JohannesLamers Can you share what the relevant part of your multi-environment config looks like?
Brad Bell
CC BY-SA 3.0
2014-07-11T16:52:11.060Z
2014-07-11T16:52:11.060Z
carlcs
<p>Method "siteUrl" for object "Craft\ConfigVariable" does not exist</p>

<pre><code>{% for locale in otherLocales %}

    {# Is this an entry page? #}
       {% if entry is defined %}

         {# Find the current entry in the other locale #}
        {% set localeEntry = craft.entries.id(entry.id).locale(locale).first %}

        {# Make sure that it's actually localized to this locale #}
       {% if localeEntry.locale == locale %}

           {# Output a link to it #}
            &lt;link rel="alternate" hreflang="{{ locale }}" href="{{ craft.config.siteUrl[locale] ~ (localeEntry.uri != '__home__' ? localeEntry.uri) }}"&gt;
         {% endif %}

    {% else %}

        {# Just output the same path with the locale's base URL #}
        &lt;link rel="alternate" hreflang="{{ locale }}" href="{{ craft.config.siteUrl[locale] ~ craft.request.getPath() }}"&gt;
    {% endif %}
{% endfor %}
</code></pre>

CC BY-SA 3.0
2014-07-11T18:10:37.193Z
Please add more information to your question... specifically, code from config file showing how "siteUrl" is set...
Anna_MediaGirl
<localization><multi-environment>
Template error: Method "siteUrl" for object "Craft\ConfigVariable" does not exist
# Template error: Method "siteUrl" for object "Craft\ConfigVariable" does not exist

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

Method "siteUrl" for object "Craft\ConfigVariable" does not exist
{% for locale in otherLocales %}

    {# Is this an entry page? #}
       {% if entry is defined %}

         {# Find the current entry in the other locale #}
        {% set localeEntry = craft.entries.id(entry.id).locale(locale).first %}

        {# Make sure that it's actually localized to this locale #}
       {% if localeEntry.locale == locale %}

           {# Output a link to it #}
            
         {% endif %}

    {% else %}

        {# Just output the same path with the locale's base URL #}
        
    {% endif %}
{% endfor %}

**Tags:** localization, multi-environment
> **Comments:**
> **username_1**: Please add more information to your question... specifically, code from config file showing how "siteUrl" is set...  

---

## 1 answers

### Answer by username_2 on 2014-07-11. Score: 4 | Accepted answer

Did you configure siteUrl in general.php?
return array(
    // ...
    'siteUrl' => array(
        'en' => 'http://example.com/en/',
        'de' => 'http://example.com/de/',
    ),
);

> **Comments:**
> **username_0**: Yes. Also in the index.php. I use a multi-environment config file and the site is multi-language.  
> **username_3**: @JohannesLamers Can you share what the relevant part of your multi-environment config looks like?  

---

