<p>.htaccess should <em>always</em> be faster because it doesn't involve PHP or Craft at all.</p>

<p>But on top of that the {% redirect %} tag should be pretty darn quick.</p>

<p>Upon hitting it, Craft immediately calls Yii's <a href="https://github.com/yiisoft/yii/blob/1.1.15/framework/web/CHttpRequest.php#L799" rel="nofollow">CHttpRequest->redirect()</a>, which sets the redirect header and terminates the current request.</p>

CC BY-SA 3.0
2018-02-07T10:51:18.747Z
Note: if you get in the situation of requires *many* redirects [this question may be useful](https://serverfault.com/questions/414225/apache-what-is-the-best-way-to-handle-thousands-of-permanent-redirects). I only mention this because I stumbled on this page while looking for "efficient apache redirects".
AnnanFay
CC BY-SA 3.0
2014-09-06T22:51:01.817Z
2014-09-06T22:51:01.817Z
Brad Bell
<p>I dont't currently need a home page on the personal site I'm working on but I want to be able to keep the option open in the future. I currently have</p>

<pre><code>{% redirect 'portfolio' %}
</code></pre>

<p>as the only code on the index page but Craft seems to take a while before it redirects to the portfolio page.</p>

<p>I tried a rewrite rule and while it worked it doesn't change the URL and I didn't see much difference in the time it took to load the page. In fact, it seemed to take longer on my local machine running MAMP Pro 3 then the redirect tag did.</p>

<p>I also looked into <a href="https://github.com/davist11/craft-reroute">Reroute plug-in by Trevor Davis</a> which seemed to work about as well as the redirect tag, maybe slightly better.</p>

<p>Any thoughts as to which is a better approach and why a simple index page with a redirect tag on it would take so long to process?</p>

<redirect><reroute><htaccess>
What's the most efficient way to handle a redirect of the home page?
# What's the most efficient way to handle a redirect of the home page?

(Asked by: username_0 on 2014-09-06)

I dont't currently need a home page on the personal site I'm working on but I want to be able to keep the option open in the future. I currently have
{% redirect 'portfolio' %}

as the only code on the index page but Craft seems to take a while before it redirects to the portfolio page.
I tried a rewrite rule and while it worked it doesn't change the URL and I didn't see much difference in the time it took to load the page. In fact, it seemed to take longer on my local machine running MAMP Pro 3 then the redirect tag did.
I also looked into Reroute plug-in by Trevor Davis which seemed to work about as well as the redirect tag, maybe slightly better.
Any thoughts as to which is a better approach and why a simple index page with a redirect tag on it would take so long to process?

**Tags:** redirect, reroute, htaccess


---

## 1 answers

### Answer by username_1 on 2014-09-06. Score: 4 | Accepted answer

.htaccess should *always* be faster because it doesn't involve PHP or Craft at all.

But on top of that the {% redirect %} tag should be pretty darn quick.

Upon hitting it, Craft immediately calls Yii's [CHttpRequest->redirect()](https://github.com/yiisoft/yii/blob/1.1.15/framework/web/CHttpRequest.php#L799), which sets the redirect header and terminates the current request.

> **Comments:**
> **username_2**: Note: if you get in the situation of requires *many* redirects [this question may be useful](https://serverfault.com/questions/414225/apache-what-is-the-best-way-to-handle-thousands-of-permanent-redirects). I only mention this because I stumbled on this page while looking for "efficient apache redirects".  

---

