Symfony-check

Check if your symfony application is ready for deployment

"Oops! Page Not Found" error page
  • high
  • design

When the URL entered by the user doesn't match any route or when an sfError404Exception occurs, symfony tries to access to the default/error404 action.

Oops! Page Not Found

To customize the "Oops! Page Not Found" page, add the executeError404() method in apps/frontend/modules/default/actions/actions.class.php:

/**
 * Error page for page not found (404) error
 *
 */
public function executeError404()
{
}

Then create the apps/frontend/modules/default/templates/error404Success.php template.

If you want, you can grab the original file and modify it.

Display the "Oops! Page Not Found" page to test it

In an action that works fine, add on top :

throw new sfError404Exception('Only for test, don\'t forget to remove it!');

Test the related page in the production environement.

If your default module is protected

Make sure to un-secure the error404 action in apps/frontend/modules/default/config/security.yml:

error404:
  is_secure: false

Using an other module

If you want to use an other module, modify apps/frontend/config/settings.yml:

all:
  .actions:
    error_404_module: foo   # To be called when a 404 error is raised
    error_404_action: bar   # Or when the requested URL doesn't match any route

Clear your cache.

php symfony cc