CodeIgniter Forums
[Secret] 404 errors - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: [Secret] 404 errors (/showthread.php?tid=2139)



[Secret] 404 errors - El Forum - 07-18-2007

[eluser]@li[/eluser]
Hi,

On the latest version of CI, I'm getting a 404 error if I try to go to a URL such as:

http://localhost/blog/admin/create/123/

Blog is the directory where my app is placed. I do have a directory called 'admin' in application/controllers, and there's a controller called 'create.php' in that directory as well. Simply going to http://localhost/blog/admin/create/ works, but if I put something else after the URL, (e.g the /123/), I get a 404 error. I need to pass on some information to the controller through the URL, so I must be able to add more segments to it.

I found that in system/libraries/Router.php, on line #177, changing:

$this->set_method($segments[1]);

to:
$this->set_method($segments[0]);

fixes this, but it causes CI to give a 404 error in some other places.

Has anybody else noticed this problem? Any ideas?


[Secret] 404 errors - El Forum - 07-18-2007

[eluser]Glen Swinfield[/eluser]
http://localhost/blog/admin/create/ --- is calling the index() action of the Create controller,

http://localhost/blog/admin/create/123 --- is calling the 123 action of the create controller, unless you tell it otherwise in the routes.php file. ???

$route['create/:any'] = "admin/create/index";

Or have I misread your question?


[Secret] 404 errors - El Forum - 07-18-2007

[eluser]@li[/eluser]
That was it. Thanks mate.