title: How can I redirect to previous page in zend framework 2?
body: <p>For these situations, I want to auto redirect back to the pages from where I made the request:</p>
  
  <ol>
  <li>After finishing any action (CRUD etc) - Here I think we need to redirect to 'HTTP_REFERER'</li>
  <li>While surfing or shopping, if login required, so after finishing authentication process, it should redirect back to the same page</li>
  </ol>
  
  <p>A different situation (which is not 'redirect to previous page'):</p>
  
  <ul>
  <li>Pass a redirect URL (landing page address) in query, for eg: If I send a (external)/URL (ofc encoded) in as GET query parameter (or route part), after login, it should redirect me to this URL</li>
  </ul>
  
  <p>I have already searched over net for this and found <a href="https://stackoverflow.com/questions/1249274/redirect-to-previous-page-in-zend-framework">some solutions</a> but they are not according to <strong>Zend Framework 2</strong>. I want all this to be done in zf2 way.</p>
  
  <p>Thanks for any help!</p>