Codeigniter .htaccess:授予所有文件的公共访问权限,但不授予文件夹

my file format like

  application
       - controllers
       - views etc...
  assetes
       - Images
       - Css etc...

and my .htaccess file are below:

#Deny from all
RewriteEngine on
RewriteCond $1 !^(index\.php|assets|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]

My problem is that assets folder access to every one any user veiw all images and all css file but needed is only user access assets folder file not the access entire folder

please help me thanks!

Blocking directory access can be done by simply putting a index.html file in the folder you want to block directory access to.

This is the way the standard CodeIgniter install does it. The below index.html file can be found in the application\controllers folder.

<html>
<head>
    <title>403 Forbidden</title>
</head>
<body>
    <p>Directory access is forbidden.</p>
</body>
</html>

use the Following lines in your htaccess RewriteCond %{REQUEST_FILENAME} !-f this is for the File accesss

RewriteCond %{REQUEST_FILENAME} !-d this is for the dictory accesss