CodeIgniter Forums
how do i get to restrict access to my folders - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: how do i get to restrict access to my folders (/showthread.php?tid=40188)



how do i get to restrict access to my folders - El Forum - 04-01-2011

[eluser]ebuoe[/eluser]
hello ... am building a website with a lot of image galleries , i store the images in folders ,but i want to restrict access to the folders via url .i.e i don't want people to have access to my image folder using a url like this::

http://website/all_images/

all images is the folder that contains the image folder .. i tried using a htaccess file

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^CI_system.*
RewriteRule ^(.*)$ /website/index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|all_images)
RewriteRule ^(.*)$ /website/index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>

ErrorDocument 404 /index.php
</IfModule>

the rewrite condition for the index.php works well but i still get access to all my folders via the url


how do i get to restrict access to my folders - El Forum - 04-01-2011

[eluser]InsiteFX[/eluser]
Code:
// Read and write for owner, nothing for everybody else
&lt;?php chmod("/somedir/somefile", 0600);?&gt;

You can also do this with an FTP Program!

InsiteFX


how do i get to restrict access to my folders - El Forum - 04-07-2011

[eluser]ebuoe[/eluser]
thanks culdn't figure out a way to apply your method ... i put index.php files in all the image folders but i will still find a way to implement yours it seems more efficient to you