title: Redirect two steps back in Symfony
body: <p>Using Symfony 4, I have a route to edit an entity that redirects the user to another route after submission like so: </p>
  
  <pre><code>if ($form-&gt;isSubmitted() &amp;&amp; $form-&gt;isValid()) {
  
          //....
  
          $em-&gt;persist($thisEntity);
          $em-&gt;flush();
  
          return $this-&gt;redirectToRoute('this_entity_index');
      }
  </code></pre>
  
  <p>On the <code>index page</code> of the entity that is rendered through the route <code>this_entity_index</code>  I display buttons to edit an entity, so this redirect makes sense. However, I have a different <code>show page</code> (rendered through a <code>show_route</code>) for this entity, which also contains an edit button that routes to the edit-route. After editing, the user would again be redirected to the <code>index page</code> of the entity. What I would like to happen in that case, is to have to user redirected to the <code>show page</code> in that case, so essentially, I need to send the user two steps back. 
  If I use: </p>
  
  <pre><code>return $this-&gt;redirect($request-&gt;headers-&gt;get('referer'));
  </code></pre>
  
  <p>The user simply gets send back to the edit form (one step back). Perhaps there is a simply solution to send the user back two steps? This way I could send the user back to the <code>index page</code>, <code>show page</code> or any other page the user came from. Do I have to work with the session of the user? Any suggestions are appreciated. </p>