No direct script access allowed

Hi guys,

i am new to codignitor. I can’t able to get my controller to work.
i spent half a day now. i am having a hard time with the error “No direct script access allowed”.

Please help me to resolve this issue.

Trouble Shooting

i tested the base path and it shows the path correctly.
i just added

echo base_url();

to hosting.xxxweb.xyz/public/index.php**
and iscorrectly printing the project folder as shown below.

https://hosting.xxxweb.xyz/public

Customers.php Controller

 <?php

defined('BASEPATH') OR exit('No direct script access allowed');

class Customers extends CI_Controller {

    public function __construct() {
        parent::__construct();
        $this->load->helper('url', 'form');
        $this->load->library('form_validation');
    }

    public function index() {
        $this->load->view('header');
        $this->load->view('footer');
    }

View

View folder has header.php and footer.php files. Which should be loading when Customers Controller is called.

So when executed the URL https://hosting.xxxweb.xyz/public/customers/index

the error is appring.

What is in your index.php?

i am so sorry, looks like i had banged my head with codig version 4.
i just follow another tuto on how to setup coding 3 and now evything is fine.

@rpkamp Thanks for your intrest in resolving my issue. i am now alright with version 3.

cheers.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.