Htaccess, auth use index.php, but allow some folder without any authorization

The first time I post something here, I usually find what I need, I hope you could help me, and maybe this will help others too.

I have manual mvc (php / html / js / bootstrap only) and I need to restrict access to a few, but allow others, I tried several answers, but nothing works in my case.

Here is my directory structure:

Directory structure

So, here is my problem, I want people to log in to allow access to index.php and all directories. This part is great and very easy to set up. But I also need to allow them access to 3 folders without any auth ("/ datas", "/ datasProd", as well as "/ jeux"). I tried to add some htaccess to the folders where I wrote this to allow everyone:

Order Allow,Deny
Allow from all

And here is my root htaccess

<Files index.php>

AuthUserFile "<path to my htpasswd>"
AuthName "Accès Restreint"
AuthType basic
require valid-user

</Files>

Order Allow,Deny
Deny from all

With this configuration, I must auth access index.php, but I must also log in if I want to access the contents of the data, datasProd and jeux. I think the problem comes from my root htaccess, but I cannot figure out what will go wrong: /

I tried to be as clear as possible, but I ask if you need more information about my setup.

Thanks for the help! and sorry for my english ...

+4
2

hello set en , : ""

SetEnvIf Request_URI 'permitted' allow

AuthType Basic
AuthName 'dev access'
AuthUserFile /var/www/htdocs/.htpasswd
Require valid-user

Allow from env=allow
Deny from all
Satisfy any
0

, , , ,

htaccess :

AuthType Basic
AuthName 'Acces Admin'
AuthUserFile "/home/www/fabrique/www/jeuxjuniorAugustins/.htpasswd"
Require valid-user

, htaccess

Satisfy any

. , index.php , , htaccess.

0

Source: https://habr.com/ru/post/1615284/


All Articles