PHP – CakePHP – Redirect all 404s to Index Page

This given PHP example redirect to index page if there is 404 error in your site.

Create the file app/app_error.php with the following code.

Code Example:
class AppError extends ErrorHandler {
    function error404($params) {
        // redirect to homepage

Post to Twitter Post to Digg Post to Facebook Post to Google Buzz Send Gmail

Leave a Comment

Your email address will not be published. Required fields are marked *