简体   繁体   中英

Restrict User For Folder Access in php

I am new in php i want to restrict user for folder access user can not access my images folder and i have one thumb folder in that images folder what should i do for that.

exammple :- i have one folder _cat_img and in that i have one more folder that name is t humb. i want to restrict user for both folders i am try to use code with .htaccess but it's not working. i am using this in htaccess

    **Deny from All**

but it is restrict all folders what should i do to to restrict user for particular folder access any one help me for this

Use Directory apache directive for specifying a particular directory. Then give access directives (allow or deny) inside it.

<Directory "fullpath/_cat_img">
 Order Deny,allow
 Deny from all
</Directory>


<Directory "full_path/thumb">
 Order Deny,allow
 Deny from all
</Directory>

Edit

To activate .htaccess edit your apache conf and inside virtual host section of your website add these.

<Directory documnet_root>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
</Directory>

Restart apache.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM