Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-09-18T20:30:28.677Z
Answers.LastActivityDate: 2019-09-18T20:30:28.677Z
Answers.UserDisplayName: Clark Nelson
Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-01T16:39:37.997Z
Answers.LastActivityDate: 2015-06-01T16:39:37.997Z
Answers.UserDisplayName: Mats Mikkel Rummelhoff
Body: <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>
  
Tags: <plugin-development><redirect>
Title: How to redirect from plugin?
ThreadText: # 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](https://buildwithcraft.com/classreference/services/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:
  
  ```php
  Craft::$app->getResponse()->redirect(UrlHelper::cpUrl('settings/plugins/craft-mailchimp'))->send();
  
  ```
  
  
  ---
  
  