title: How to use different unauthorized url for different roles in apache shiro
body: <p>I have been trying to assign different unauthorized url for different roles in url section of shiro.ini file for a web application but it seems I am not able to do it.Below is the code that I have tried.</p>
  
  <p><strong>shiro.ini file</strong></p>
  
  <pre><code>[main]
  
      authc1 = org.apache.shiro.web.filter.authc.FormAuthenticationFilter
      authc2 = org.apache.shiro.web.filter.authc.FormAuthenticationFilter
  
      authc1.loginUrl = /login.xhtml
      authc2.loginUrl = /secLoginPage.xhtml 
  
  
  [urls]
      /login.xhtml = authc1
      /secLoginPage.xhtml  = authc2
      /testapp/** = authc1, roles[admin,unauthorizedUrl=/adminAuthPage.xhtml]
      /userfld/**=authc2,roles[user,unauthorizedUrl=/abortPage.xhtml]
      /** = authc1
      /** = authc2
  </code></pre>
  
  <p>After login to the application its redirect to authorized page with error <code>Error 401: SRVE0295E: Error reported: 401</code>.</p>
  
  <p>This error occurred after I added <code>unauthorizedUrl=/adminAuthPage.xhtml</code>.
  If there is any mistake in code please suggest.</p>