<p>Environment variables are only available in specific settings, and Entry URL Formats are not one of them.</p>

<p>There’s no need to include your Site URL in there anyway, though. The field’s label might be a little misleading – it’s really more of a <em>URI</em> format than a <em>URL</em> format.</p>

<p>If you want your entries to get URLs like <a href="http://example.com/entry-slug" rel="nofollow">http://example.com/entry-slug</a>, then all you need to put in your section’s Entry URL Format setting is:</p>

<pre><code>{slug}
</code></pre>

CC BY-SA 3.0
2014-10-24T12:54:01.143Z
Thanks - changing that has removed the error.
I have it set like that in a previous site and it worked but must be something else to it.
mmc501
CC BY-SA 3.0
2014-10-24T13:05:58.583Z
@mmc501 Glad you’re all sorted. The only way it would work is if you had a custom field with the handle “siteUrl”.
Brandon Kelly
CC BY-SA 3.0
2014-10-24T12:30:06.250Z
2014-10-24T12:30:06.250Z
Brandon Kelly
<p>Getting the above error when trying to add a new entry to a structure section.</p>

<p>The Section has an Entry URL Format of:</p>

<p>{siteUrl}/{slug}</p>

<p>In my general.php in the config folder I have:</p>

<pre><code>return array(

    '*' =&gt; array(
            'omitScriptNameInUrls' =&gt; true,
        ),


    'local.ontherocks.dev' =&gt; array(
        'devMode' =&gt; true,
        'environmentVariables' =&gt; array(
            'basePath' =&gt; 'C:/Users/User/Documents/My Websites/Sitename/public/',
            'baseUrl'  =&gt; 'http://local.ontherocks.dev/',
            'siteUrl'  =&gt; 'http://local.ontherocks.dev/',
        )   
    )

);
</code></pre>

<p>I don't see why I am getting this error - I have the same set up in another site I did.</p>

<entrymodel><siteurl>
Craft\EntryModel and its behaviors do not have a method or closure named "siteUrl"
# Craft\EntryModel and its behaviors do not have a method or closure named "siteUrl"

(Asked by: username_0 on 2014-10-24)

Getting the above error when trying to add a new entry to a structure section.
The Section has an Entry URL Format of:
{siteUrl}/{slug}
In my general.php in the config folder I have:
return array(

    '*' => array(
            'omitScriptNameInUrls' => true,
        ),


    'local.ontherocks.dev' => array(
        'devMode' => true,
        'environmentVariables' => array(
            'basePath' => 'C:/Users/User/Documents/My Websites/Sitename/public/',
            'baseUrl'  => 'http://local.ontherocks.dev/',
            'siteUrl'  => 'http://local.ontherocks.dev/',
        )   
    )

);

I don't see why I am getting this error - I have the same set up in another site I did.

**Tags:** entrymodel, siteurl


---

## 1 answers

### Answer by username_1 on 2014-10-24. Score: 1 | Accepted answer

Environment variables are only available in specific settings, and Entry URL Formats are not one of them.
There’s no need to include your Site URL in there anyway, though. The field’s label might be a little misleading – it’s really more of a URI format than a URL format.
If you want your entries to get URLs like http://example.com/entry-slug, then all you need to put in your section’s Entry URL Format setting is:
{slug}

> **Comments:**
> **username_0**: Thanks - changing that has removed the error. I have it set like that in a previous site and it worked but must be something else to it.  
> **username_1**: @username_0 Glad you’re all sorted. The only way it would work is if you had a custom field with the handle “siteUrl”.  

---

