Search code examples
phpadminrestrict

how to restrict access to admin folder except logged user


I have folder /admin/index.php how to restrict access to that folder except logged user. I try to restrict access with .htaccess but it restrict access at all


Solution

  • On your /admin/index.php are you checking these things:

    1. Is the user logged in? - If not, redirect them to the login page.
    2. Is the logged in user an Admin? - If not, redirect them to another page.

    Seems like the logical way to tackle this.