0

Hello I am new in cakephp and I want to show an error page if someone enter wrong url in my cakephp application.

I am using this code as per given example on internet

CakePHP 2.0 - How to make custom error pages?

I am unable to see any custom error page in my application.I have used all the given steps added in that url

Community
  • 1
  • 1
alex
  • 37
  • 1
  • 8

2 Answers2

1

Try the second answer:

To customize the content of a 404-error page and don't need custom logic, simply edit the contents of app/View/Errors/error400.ctp.

Note that you need to also set your debug level to zero to see your custom error page.

Ben Hitchcock
  • 1,368
  • 10
  • 12
0

The best way is handle all errors in AppController.php

public function beforeRender() { parent::beforeRender(); if ($this->name == 'CakeError') { $this->redirect(array( 'controller' => 'ExampleController', 'error_action')); } }

And make view View/ExampleController/error_action.ctp with your needs.