<p>In Craft 3 we are looking at something similar to:</p>

<pre class="lang-php prettyprint-override"><code>Craft::$app-&gt;getResponse()-&gt;redirect(UrlHelper::cpUrl('settings/plugins/craft-mailchimp'))-&gt;send();
</code></pre>

CC BY-SA 4.0
2019-09-18T20:30:28.677Z
2019-09-18T20:30:28.677Z
Clark Nelson
<p>You can use the <a href="https://buildwithcraft.com/classreference/services/HttpRequestService">HttpRequestService</a>:</p>

<pre><code>craft()-&gt;request-&gt;redirect($myAwesomeUrl);
</code></pre>

CC BY-SA 3.0
2015-06-01T16:39:37.997Z
2015-06-01T16:39:37.997Z
Mats Mikkel Rummelhoff
<p>My plugin init function:</p>

<pre><code>function init(){

    craft()-&gt;entries-&gt;onSaveEntry = function(Event $event) {

        //redirect to wanted url

    };

}
</code></pre>

<p>Is there a fancy way to redirect to my plugin url if, for example the entry channel is jobs.</p>

<p>Or I have to use header() function. Thank you in advance.</p>

<plugin-development><redirect>
How to redirect from plugin?
# How to redirect from plugin?

(Asked by: username_0 on 2015-06-01)

My plugin init function:
function init(){

    craft()->entries->onSaveEntry = function(Event $event) {

        //redirect to wanted url

    };

}

Is there a fancy way to redirect to my plugin url if, for example the entry channel is jobs.
Or I have to use header() function. Thank you in advance.

**Tags:** plugin-development, redirect


---

## 2 answers

### Answer by username_2 on 2015-06-01. Score: 14 | Accepted answer

You can use the HttpRequestService:
craft()->request->redirect($myAwesomeUrl);


---

### Answer by username_1 on 2019-09-18. Score: 11

In Craft 3 we are looking at something similar to:
Craft::$app->getResponse()->redirect(UrlHelper::cpUrl('settings/plugins/craft-mailchimp'))->send();


---

