How To Use A Sub Folder In Default Controller Route In Codeigniter 3
Posted Date:24-05-2017
In this post we will explain how to use a sub folder in default controller route in codeigniter 3
How to use a sub folder in default controller route in codeigniter 3
step1:Open application->system->Router.php file and edit the below mention line number
line 1(298). if (sscanf($this->default_controller, ‘%[^/]/%s’, $class, $method) !== 2)
The above code replace to
if (!sscanf($this->default_controller, '%[^/]/%[^/]/%s', $directory, $class, $method) !== 2)
step3:
line 2(303). if ( ! file_exists(APPPATH.’controllers/’.$this->directory.ucfirst($class).’.php’))
The above code replace to
if ( ! file_exists(APPPATH.'controllers'. DIRECTORY_SEPARATOR . $directory. DIRECTORY_SEPARATOR .ucfirst($class).'.php'))
Step4:
Just add the below line before $this->set_class($class);
line 3(309). $this->set_directory($directory);