# How to protect admin panel with htaccess

**URL:** <https://discourse.slimframework.com/t/how-to-protect-admin-panel-with-htaccess/5964>\
**Category:** Questions\
**Created:** [August 2, 2024, 9:28am UTC](https://discourse.slimframework.com/t/how-to-protect-admin-panel-with-htaccess/5964 "2024-08-02T09:28:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![markosci](https://avatars.discourse-cdn.com/v4/letter/m/48db29/32.png) [@markosci](https://discourse.slimframework.com/u/markosci)\
**Post date:** [August 2, 2024, 9:28am UTC](https://discourse.slimframework.com/t/how-to-protect-admin-panel-with-htaccess/5964/1 "2024-08-02T09:28:12Z")

</div>

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

```auto
* 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.
