Render Custom 404 (Bad Request) Page Error

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 !

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.

See more information at:

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.

I see, then you you can check framework\base\CErrorHandler.php.

	protected function getViewFileInternal($viewPath,$view,$code,$srcLanguage=null)











		return $viewFile;


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.