<p>You do not use the {{ }} inside other brackets you also should not use ' ' unless it is a specific string you want interpreted. Try instead:</p>

<pre><code>{% for entry in craft.entries.section('services').limit(1) %}
     {% redirect entry.url %}
{% endfor %}
</code></pre>

<p>And you should be good to go</p>

CC BY-SA 3.0
2016-10-01T14:39:54.820Z
2016-10-01T14:39:54.820Z
Christopher Healey
<p>I've set up a structure channel that has entries at /services/slug however I want the /services template to redirect to the first entry in the services structure. </p>

<p>What I have now is:</p>

<pre><code>{% for entry in craft.entries.section('services').limit(1) %}
  {% redirect '{{ entry.url }}' %}
{% endfor %}
</code></pre>

<p>However when visiting /services this redirects to a 404 page with url of <code>/%7B%7B%20entry.url%20%7D%7D/</code></p>

<p>I also tried {% redirect "services/{{ entry.slug }}" %} but that didn't work either.</p>

<p>Is it possible to set up a redirect in the way that I am trying to do here?</p>

<templating><redirect>
{% redirect "{{ entry.url }}" %} doesn't work
# {% redirect "{{ entry.url }}" %} doesn't work

(Asked by: username_0 on 2016-10-01)

I've set up a structure channel that has entries at /services/slug however I want the /services template to redirect to the first entry in the services structure. 
What I have now is:
{% for entry in craft.entries.section('services').limit(1) %}
  {% redirect '{{ entry.url }}' %}
{% endfor %}

However when visiting /services this redirects to a 404 page with url of /%7B%7B%20entry.url%20%7D%7D/
I also tried {% redirect "services/{{ entry.slug }}" %} but that didn't work either.
Is it possible to set up a redirect in the way that I am trying to do here?

**Tags:** templating, redirect

---

## 1 answers

### Answer by username_1 on 2016-10-01. Score: 8 | Accepted answer

You do not use the {{ }} inside other brackets you also should not use ' ' unless it is a specific string you want interpreted. Try instead:
{% for entry in craft.entries.section('services').limit(1) %}
     {% redirect entry.url %}
{% endfor %}

And you should be good to go


---

