<p>That should work fine.  I just did a test in a simple template with:</p>

<pre><code>{% redirect "http://google.com" 301 %}
</code></pre>

<p>And I can see it's a proper 301 redirect.  Try clearing your browser's cache?</p>

CC BY-SA 3.0
2015-04-13T18:47:27.650Z
The redirect function is from Yii. Documentation can be found here: http://www.yiiframework.com/doc/api/1.1/CHttpRequest#redirect-detail
Aaron Berkowitz
CC BY-SA 3.0
2015-04-13T18:46:12.793Z
2015-04-13T18:46:12.793Z
Brad Bell
<p>Although undocumented, according to this answer <a href="https://craftcms.stackexchange.com/questions/8248/how-do-i-force-a-301-http-status-code-using-the-redirect-tag/8249#8249">How do I force a 301 http status code using the redirect tag?</a> adding a 301 parameter to the redirect tag should change the status. I am using this but am still getting a 302 status.</p>

<pre><code>{% redirect entry.getChildren().first().url 301 %}
</code></pre>

<p>Should this work to create a 301?</p>

<redirect>
Can the HTTP status be set with the redirect tag
# Can the HTTP status be set with the redirect tag

(Asked by: username_0 on 2015-04-13)

Although undocumented, according to this answer How do I force a 301 http status code using the redirect tag? adding a 301 parameter to the redirect tag should change the status. I am using this but am still getting a 302 status.
{% redirect entry.getChildren().first().url 301 %}

Should this work to create a 301?

**Tags:** redirect


---

## 1 answers

### Answer by username_1 on 2015-04-13. Score: 3

That should work fine.  I just did a test in a simple template with:
{% redirect "http://google.com" 301 %}

And I can see it's a proper 301 redirect.  Try clearing your browser's cache?

> **Comments:**
> **username_2**: The redirect function is from Yii. Documentation can be found here: http://www.yiiframework.com/doc/api/1.1/CHttpRequest#redirect-detail  

---

