title: How to redirect "Access denied" to login page in Silex
body: <p>This is my firewall code </p>
  
  <pre><code>$app['security.firewalls']=[
      'secured'=&gt;[
          'pattern' =&gt; '/',
          'anonymous' =&gt; true,
          'http'=&gt;true,
          'form' =&gt; array('login_path' =&gt; '/login', 'check_path' =&gt; '/secured/login_check'),
          'logout' =&gt; array('logout_path' =&gt; '/secured/logout', 'invalidate_session' =&gt; true),
          'users'=&gt;$users
      ]
  ];
  $app['security.access_rules']=[
      ["^/admin", "ROLE_ADMIN"]
  ];
  </code></pre>
  
  <p>When users access admin page without role admin, how to redirect them to login page?</p>
  
  <p>I have test with no access rules in admin controller code:</p>
  
  <pre><code>if($app['security.authorization_checker']-&gt;isGranted('ROLE_ADMIN')){
          // ...
          // ...
          // ...
      }
  else return $app-&gt;redirect($app-&gt;url('login'));
  </code></pre>
  
  <p>But the problem when I use this method is that it will redirect to homepage instead of previous page. How can I make login page to redirect to previous page instead of homepage after successful login check?</p>