March 10, 2014, 2:15pm
Hello, now when an user types a wrong url appears this error page:
That it is correct, it is an error, and that it is what it has to show to the user, but I would like to render my own page and better render inside my project with my custom message.
How do I do that ?
Thanks in advance !
March 11, 2014, 6:20pm
This is about your HTTP_BAD_REQUEST.html in Apache services. (Guess you are using Apache)
Try to find out your Apache directory on your host server, and you should be able to see "/error" under Apache direcotry, and there are all error documents.
You can customize the error responses in httpd.conf file:
For example, add below statement for error 404:
ErrorDocument 404 "http://www/yoursite/index.php"
Then it will redirect to an external url, you also can redirect to your local page file in your document root.
March 11, 2014, 6:25pm
March 12, 2014, 3:04pm
Hello, this error doesn’t come to apache, this error is a render of the page sited in the Yii framework
/views/error400.php, I want that instead of render this page, render a custom view inside my project.
March 12, 2014, 5:53pm
I see, then you you can check framework\base\CErrorHandler.php.
protected function getViewFileInternal($viewPath,$view,$code,$srcLanguage=null)
You’d better extend CErrorHandler class, and create your own HandlerError functions,which can render your own error.php file or redirect to a certain page.