[eluser]PhilTem[/eluser]
I'm not sure if it is really a bug or if I just got the user's guide wrong.
Within the index.php under the root-directory of a default CI application there's a section defined by
Code:
/*
* --------------------------------------------------------------------
* DEFAULT CONTROLLER
* --------------------------------------------------------------------
*
* Normally you will set your default controller in the routes.php file.
* You can, however, force a custom routing by hard-coding a
* specific controller class/function here. For most applications, you
* WILL NOT set your routing here, but it's an option for those
* special instances where you might want to override the standard
* routing in a specific front controller that shares a common CI installation.
*
* IMPORTANT: If you set the routing here, NO OTHER controller will be
* callable. In essence, this preference limits your application to ONE
* specific controller. Leave the function name blank if you need
* to call functions dynamically via the URI.
*
* Un-comment the $routing array below to use this feature
*
*/
So I thought, if I set a default controller and function like
Code:
// The directory name, relative to the "controllers" folder. Leave blank
// if your controller is not in a sub-folder within the "controllers" folder
// $routing['directory'] = '';
// The controller class file name. Example: Mycontroller
$routing['controller'] = 'bootstrap';
// The controller function you wish to be called.
$routing['function'] = 'route';
then any url will be routed to 'bootstrap/route' and I can do whatever I want to do.
But somehow, urls like
Code:
example.com/index.php/some_test/text_here
gets actually routed to controller
some_test with method
text_here.
I was looking at the code of the
Router class and came across line 284 where the controller-file is searched. And if it cannot be found, a 404 is shown. But I think that's the problem, since the request gets validated as soon as there are segments in the url and before the overrides are set (line 178 in system/core/CodeIgniter.php).
There is no problem using routes.php and setting
Code:
$route['.+'] = 'bootstrap/route';
but I wanted to use the default-controller setting in index.php since otherwise I'd have many many routes to set up and for me it's easier to use a default bootstrap controller that will route my requests.
Anybody else can confirm this bug? Or confirm my misunderstanding of the documentation?
Thanks a lot in advance