简体   繁体   中英

Deny access permissions - apache, linux

How can I deny access permission to an entire folder except one file? For example, my DocumentRoot is "/var/www/html" and there I have a folder called example . In there, there are many files and one of them is index.php . So I want to give access permission only to this file, and deny access permissions to the other files in that folder.

did you try something like this into your apache configuration (server httpd.conf or .htaccess file) ?

<Directory "/var/www/html/example">
   <FilesMatch index.php*> 
      Order allow,deny 
      Allow from all 
   </FilesMatch> 
   Order deny,allow 
   Deny from all 
</Directory>

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