Reputation: 351
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!
Upvotes: 2
Views: 12428
Reputation: 10886
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>
Upvotes: 8
Reputation: 1549
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
Upvotes: 0