2

I have a codeigniter project. If i create a folder in root direct that can't provide codeigniter framework by default, if i hit a url with base_url + folder_name(http://localhost/Magpie/css/) as a result browser will shown all the file in this folder screenshot attach in bellow :

How can i Manage this problem

enter image description here


Already I used a .htaccess file in project root directory. my .htaccess code in bellow :

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /Magpie/
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]
</IfModule>

3 Answers3

1

update your .htaccess with this

I have just added Options -Indexes in you .htaccess

<IfModule mod_rewrite.c>
Options -Indexes
RewriteEngine on
RewriteBase /Magpie/
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]
</IfModule>
sparsh turkane
  • 1,165
  • 12
  • 13
1

Update your .htaccess file and add below line on top

Options -Indexes
D P
  • 328
  • 1
  • 8
0

If you create a extra folder that can't provide codeigniter framework by default.

To restrict the folder's all file follow the next Step :

Step-1

create a .htaccess file into the folder

Step-2

save this line of code that provide in bellow:

 Options -Indexes

enter image description here

Step-3

Now Run your Project