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.
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.
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.
default
module is protectedMake sure to un-secure the error404
action in apps/frontend/modules/default/config/security.yml
:
error404:
is_secure: false
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
Powered by jQuery UI and symfony. Symfony Check
The content this site is published under a Creative Commons License. Some parts of the content are a remix of the official symfony documentation.