Welcome Guest, Not a member yet? Register   Sign In
Create Custom 404 error page
#1

(This post was last modified: 10-04-2018, 08:28 AM by imabot.)

Hi, I'm new to CodeIgniter, and it's not clear for me on how to create a custom 404 page. I already read the following posts :

https://forum.codeigniter.com/thread-66769.html
https://forum.codeigniter.com/thread-66110.html
https://forum.codeigniter.com/thread-64942.html
https://forum.codeigniter.com/thread-64591.html
https://forum.codeigniter.com/thread-64591.html
https://forum.codeigniter.com/thread-61587.html

and the following links:

https://stackoverflow.com/questions/3447...error-page
https://www.codexworld.com/codeigniter-c...rror-page/
http://www.bourzeix.com/weblog/post/2012...odeIgniter
https://www.lucidar.me/en/codeigniter-3-...e-ignitor/

The last one is probably the most interesting and I concluded there are two options :
  • Update the content of /application/views/errors/html/error_404.php
  • Create a new route : $route['404_override'] = /myController/myMethod
None is satisfying because the first option prevent you from using custom templates for header and footer, and the second one doesn't work when the error_404() function is called.

What is the best practice to create a custom 404 error page ?
Reply
#2

You can create your custom 404 page, I'm doing it and it works fine.
Practical guide to IgnitedCMS - Book coming soon, www.ignitedcms.com
Reply
#3

(10-04-2018, 09:28 AM)ignitedcms Wrote: You can create your custom 404 page, I'm doing it and it works fine.

Did you read my question until the end ?
Reply
#4

@imabot,

You could also just create an standard page and make it a custom error page. There is no rule that states that you have to reconfigure the CI error page.
Reply
#5

(10-08-2018, 07:59 AM)php_rocs Wrote: @imabot,

You could also just create an standard page and make it a custom error page.  There is no rule that states that you have to reconfigure the CI error page.

Yes, this is what I did, but it's not working when calling the error_404() function. 

I finally used the solution described on this page : https://www.lucidar.me/en/codeigniter-3-...e-ignitor/

Not perfect, but do the job.
Reply
#6

(This post was last modified: 04-15-2020, 10:15 PM by yafenic34. Edit Reason: spelling )

(10-08-2018, 09:47 AM)imabot Wrote:
(10-08-2018, 07:59 AM)php_rocs Wrote: @imabot,

You could also just create an standard page and make it a custom error page.  There is no rule that states that you have to reconfigure the CI error page.

Yes, this is what I did, but it's not working when calling the error_404() function. 

I finally used the solution described on this page : https://www.lucidar.me/en/codeigniter-3-...e-ignitor/

Not perfect, but do the job.

I was working on new application krogerfeedback on my localhost, and tried to create a custom 404 but it always returned error.

But now, when i search for the solution. I got this thread and the reference guide mentioned hear really helped me.

Thanks, to Imabot.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB