Labeeb
Labeeb

Reputation: 369

How to restrict access to views in Codeigniter?

Using Codeigniter I want to make my home.php restricted to only registered users but when I try following

http://127.0.0.1/CodeIgniter_2.1.4/application/views/home.php

I get access to home.php(which is in views). I thought that CI has some restriction for this type of request but its not.So now how can I solve this.

Should I do this in .htaccess? OR I should add php code at the top of home.php which will check for valid session data etc.

Upvotes: 0

Views: 1292

Answers (2)

Ryan Kempt
Ryan Kempt

Reputation: 4209

http://ellislab.com/codeigniter/user-guide/installation/

For the best security, both the system and any application folders should be placed above web root so that they are not directly accessible via a browser. By default, .htaccess files are included in each folder to help prevent direct access, but it is best to remove them from public access entirely in case the web server configuration changes or doesn't abide by the .htaccess.

Upvotes: 2

DeiForm
DeiForm

Reputation: 664

In your application folder make .htaccess with this:

Deny from all

Upvotes: 1

Related Questions