<p>If you want to use the {siteUrl} tag in your Asset source settings, you'll still additionally need to define it in your <a href="http://buildwithcraft.com/docs/multi-environment-configs#environment-specific-variables">environment variables</a> as well.</p>

<p>See <a href="https://craftcms.stackexchange.com/questions/920/what-s-the-recommended-way-to-set-the-site-url/921#comment1751_921">here as well</a>. </p>

CC BY-SA 3.0
2014-07-25T21:59:13.383Z
Ohhhhhh. And here I thought I was already doing that. Turns out I need an actual `'environmentVariables' => array( 'siteUrl' => 'http://whatever.com/' )`. Matt 0, RTFM +1. Thanks Brad.
Matt Stein
CC BY-SA 3.0
2014-07-25T21:54:28.530Z
2014-07-25T21:54:28.530Z
Brad Bell
<p>I'm working on my first subfolder-based Craft site, so I'm relying on Asset URLs based on the <code>{{ siteUrl }}</code> variable. I cannot, however, manage to get them working. Any tags I add to the URL field in the control panel get printed literally (not parsed) in the template output.</p>

<p>My config.php looks like this:</p>



<pre><code>return array(

    '*' =&gt; array(
    ),

    'foo.craft.dev' =&gt; array(
        'siteUrl' =&gt; 'http://foo.craft.dev/',
        'devMode' =&gt; true
    ),

    'foo.bar.com' =&gt; array(
        'siteUrl' =&gt; 'http://foo.bar.com/',
        'devMode' =&gt; true
    ),

    'example.com' =&gt; array(
        'siteUrl' =&gt; 'http://example.com/foo',
        'devMode' =&gt; false
    ),

);
</code></pre>

<p>My Logos Asset settings look like this:</p>

<p><img src="https://i.sstatic.net/NNqZY.png" alt="enter image description here"></p>

<p>And a relevant chunk of template looks like this:</p>

<pre><code>&lt;div class="logos"&gt;
    {% for logo in logos.logoImages %}
        &lt;a href="{{ logo.websiteUrl }}" target="_blank" style="background-image: url({{ logo.geturl() }}); padding-top: {{ logo.getHeight() }}px; width: {{ logo.getWidth() }}px;"&gt;{{ logo.companyName }}&lt;/a&gt;
    {% endfor %}
&lt;/div&gt;
</code></pre>

<p>The <code>background-image</code> URL above renders out as <code>{siteUrl}assets/logos/logo.gif</code>, which isn't parsed as I would expect.</p>

<p>What have I done wrong?</p>

<assets><config>
How can I set dynamic absolute Asset URLs?
# How can I set dynamic absolute Asset URLs?

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

I'm working on my first subfolder-based Craft site, so I'm relying on Asset URLs based on the {{ siteUrl }} variable. I cannot, however, manage to get them working. Any tags I add to the URL field in the control panel get printed literally (not parsed) in the template output.
My config.php looks like this:
return array(

    '*' => array(
    ),

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

    'foo.bar.com' => array(
        'siteUrl' => 'http://foo.bar.com/',
        'devMode' => true
    ),

    'example.com' => array(
        'siteUrl' => 'http://example.com/foo',
        'devMode' => false
    ),

);

My Logos Asset settings look like this:

And a relevant chunk of template looks like this:

    {% for logo in logos.logoImages %}
        {{ logo.companyName }}
    {% endfor %}


The background-image URL above renders out as {siteUrl}assets/logos/logo.gif, which isn't parsed as I would expect.
What have I done wrong?

**Tags:** assets, config


---

## 1 answers

### Answer by username_1 on 2014-07-25. Score: 8 | Accepted answer

If you want to use the {siteUrl} tag in your Asset source settings, you'll still additionally need to define it in your [environment variables](http://buildwithcraft.com/docs/multi-environment-configs#environment-specific-variables) as well.

See [here as well](https://craftcms.stackexchange.com/questions/920/what-s-the-recommended-way-to-set-the-site-url/921#comment1751_921).

> **Comments:**
> **username_0**: Ohhhhhh. And here I thought I was already doing that. Turns out I need an actual `'environmentVariables' => array( 'siteUrl' => 'http://whatever.com/' )`. Matt 0, RTFM +1. Thanks Brad.  

---

