CodeIgniter Forums
Proper 404 for non-existing element - 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: Proper 404 for non-existing element (/showthread.php?tid=56125)



Proper 404 for non-existing element - El Forum - 11-28-2012

[eluser]Unknown[/eluser]
Hi there!

I have a website that shows interesting places in my city. Places are available under URLs:

mydomain.com/place-3333 (where 3333 is place's id).

However, if you manually type in your browser some fake ID like:

mydomain.com/place-33336756756

then application returns code 200 and shows a view without any data in there. This is not good in terms of SEO.

My model returns false if there is no such place in the database. In the controller, I have problem with proper redirecting and sending 404 error.

Could please sombody help me with it?

cheers
pete





Proper 404 for non-existing element - El Forum - 11-28-2012

[eluser]Aken[/eluser]
If you want to throw a 404 error, just use the show_404() function.