Kohana: Do I need to check if SYSPATH exists?

I am a CodeIgniter user and I am looking at Cohan. The first thing I noticed is that in the documentation, each fragment starts with:

<?php defined('SYSPATH') or die('No direct script access.');

Assuming I will use .htaccess to rewrite addresses, is this really necessary? Is an .htaccess alternative for purpura avoiding direct access? Is it just good practice to “protect in depth”?

+5
source share
2 answers

If you use a .htaccess file to protect your system files, this is not required. However, since kohana must support the use of non.htaccess, we put it in the main system files for some basic security.

+10

, , index.php( SYSPATH ).

, script . , http://example.com/application/classes/controllers/welcome.php

webroot index.php, , , .

, , , .htaccess, , , .

+5

All Articles