How to protect admin panel with htaccess

Hello guys!
I’m making a project with SLIM and that includes a little admin panel.
I’ve the next structure:

*  myproject
    *  public
       *  index.php
       * .htaccess
       * assets
       * templates
       * temp
    *  routes
      *  websiteroutes.php
    *  src
       * Controllers
       * templates
          * admin
              * dashboard.twig
   others config files 

I want to protect my adminpanel dashboard with a htaccess but I can’t make it
I tryed with a admin folder with a htaccess into my public folder, tryed to put into src/templates/admin my htaccess but the result is the same.

When I put just one admin folder with only the htacces file into /public/, I saw the user and pass but when I write that, SLIM send to me a 403 error.