Answers.Body: <p><strong>Yes!</strong></p>
  
  <p>Assuming you're using some sort of business logic plugin (if you don't have one, <a href="https://github.com/lindseydiloreto/craft-businesslogic" rel="nofollow noreferrer">get one</a>), then simply put this code in your main <code>*Plugin.php</code> file...</p>
  
  <pre class="lang-php prettyprint-override"><code>public function init()
  {
  
      // Trigger template hook
      craft()-&gt;templates-&gt;hook('cp.entries.edit', function(&amp;$context)
      {
  
          // Check to ensure that you're in the right section
          if ('mySection' == $context['sectionHandle'])
          {
  
              // Specify the preferred URI
              $uri = 'special-page/'.$context['entry']-&gt;uri;
  
              // Set the "Save" button redirect
              craft()-&gt;templates-&gt;includeJs("
                  $(function () {
                      $('input[name=\"redirect\"]').val('{$uri}');
                  });
              ");
  
              // Set the `cmd + s` shortcut redirect
              $context['saveShortcutRedirect'] = $uri;
  
          }
  
      });
  
  }
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-12T15:54:08.567Z
Answers.Text: This *almost* works in Craft 3, changing to `Craft::$app->getView()->hook('cp.entries.edit', function(array &$context) {}` and `Craft::$app->getView()->registerJs()`. The `saveShortcutRedirect` part works fine for cmd+s saves, but even if you use the hashed version of the $uri (via `Craft::$app->getSecurity()->hashData($uri)`) it 1) triggers the "something has changed" behavior so even if you don't actually edit anything in the form, it warns you before leaving the page and 2) redirects to `/admin{$uri}`. Anybody have hints on how to implement a redirect-after-save in Craft 3?
Answers.UserDisplayName: Nate Beaty
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-12T19:57:31.997Z
Answers.Text: @natebeaty I'd recommend posting a [new question](https://craftcms.stackexchange.com/questions/ask). Feel free to link back to this thread for reference!
Answers.UserDisplayName: Lindsey D
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-20T00:37:19.250Z
Answers.LastActivityDate: 2017-04-20T05:23:05.787Z
Answers.LastEditDate: 2017-04-20T05:23:05.787Z
Answers.UserDisplayName: Lindsey D
Body: <p>I'm editing an entry in the CP...</p>
  
  <pre><code>mysite.com/admin/entries/mySection/33-my-awesome-entry
  </code></pre>
  
  <p>Now when I <strong>save</strong> this entry, it will redirect me back to the entry index page. However, I'd like to override this behavior, and get redirected to a <em>different</em> page upon saving.</p>
  
  <p><strong>Is it possible to override the redirect target when saving an entry?</strong></p>
  
Tags: <control-panel><entry><redirect><saving>
Title: Possible to redirect elsewhere after saving an entry?
ThreadText: # Possible to redirect elsewhere after saving an entry?
  
  (Asked by: username_0 on 2017-04-20)
  
  I'm editing an entry in the CP...
  
  ```
  mysite.com/admin/entries/mySection/33-my-awesome-entry
  
  ```
  
  Now when I **save** this entry, it will redirect me back to the entry index page. However, I'd like to override this behavior, and get redirected to a *different* page upon saving.
  
  **Is it possible to override the redirect target when saving an entry?**
  
  **Tags:** control-panel, entry, redirect, saving
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2017-04-20. Score: 3 | Accepted answer
  
  **Yes!**
  
  Assuming you're using some sort of business logic plugin (if you don't have one, [get one](https://github.com/lindseydiloreto/craft-businesslogic)), then simply put this code in your main `*Plugin.php` file...
  
  ```php
  public function init()
  {
  
      // Trigger template hook
      craft()->templates->hook('cp.entries.edit', function(&$context)
      {
  
          // Check to ensure that you're in the right section
          if ('mySection' == $context['sectionHandle'])
          {
  
              // Specify the preferred URI
              $uri = 'special-page/'.$context['entry']->uri;
  
              // Set the "Save" button redirect
              craft()->templates->includeJs("
                  $(function () {
                      $('input[name=\"redirect\"]').val('{$uri}');
                  });
              ");
  
              // Set the `cmd + s` shortcut redirect
              $context['saveShortcutRedirect'] = $uri;
  
          }
  
      });
  
  }
  
  ```
  
  > **Comments:**
  > **username_1**: This *almost* works in Craft 3, changing to `Craft::$app->getView()->hook('cp.entries.edit', function(array &$context) {}` and `Craft::$app->getView()->registerJs()`. The `saveShortcutRedirect` part works fine for cmd+s saves, but even if you use the hashed version of the $uri (via `Craft::$app->getSecurity()->hashData($uri)`) it 1) triggers the "something has changed" behavior so even if you don't actually edit anything in the form, it warns you before leaving the page and 2) redirects to `/admin{$uri}`. Anybody have hints on how to implement a redirect-after-save in Craft 3?  
  > **username_0**: @username_1 I'd recommend posting a [new question](https://craftcms.stackexchange.com/questions/ask). Feel free to link back to this thread for reference!  
  
  ---
  
  