Welcome Guest, Not a member yet? Register   Sign In
How to protect public folder to direct access:??
#1

How to protect public folder to direct access:??
Reply
#2

(This post was last modified: 03-08-2015, 01:38 AM by Muzikant.)

You have several options. I will put here the most easiest ones.

  1. .htacess file
    If you are using Apache server, you can use .htaccess file. Just create ".htaccess" in the folder you want to protect, and put the following code in it:
    Code:
    <IfModule authz_core_module>
        Require all denied</IfModule>
    <IfModule !authz_core_module>
        Deny from all
    </IfModule>
    This way is used by CodeIgniter itself, but not only this way of cource. In most cases it is enough and there is no problems with it.
  2. CHMOD permissions
    If you can not use a .htaccess file, or you want to improve security, you can also change CHMOD permissions. If you do not know what it is, Google it. Set permissions of the directory you want to protect on 700 or 0700 for example. It will protect your directory files from direct access, but your PHP scripts and CodeIgniter will still can work with them.

These solutions are the most easiest ways to protect your directory files. If you will write here why you want to protect your files and what types they are, you could get more accurate answers to your needs. Also remember, that if you have super important files, you should consider other and more secure ways of protection, but in most cases this is more then enough.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB