CodeIgniter Forums
Different 404 for API controllers - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Different 404 for API controllers (/showthread.php?tid=57571)



Different 404 for API controllers - El Forum - 03-23-2013

[eluser]MrAzulay[/eluser]
Hello

I'm developing a restful API for my application and if you try to access a method that doesn't exist on a controller (as you know) codeigniter automatically shows the default 404 page. This is fine for the rest of the app but for all controllers inheriting from MY_APIController I want to serve a json error response and give a 404 header.

Anyone know a good way of doing this?