Last updated April 3, 2013. Created by JuliaKM on January 9, 2005.
Edited by drupleg, LeeHunter, Michelle, puregin. Log in to edit this page.
Drupal's page error messages are meant to be direct and to the point. If you want page error messages that are a little more user-friendly, Drupal allows you to customize them.
- Create two nodes, one for each kind of page error (403 and 404).
- Determine the ID number of the node you wish to redirect users to. One way to determine the node's ID number is to visit the node and look at the number after the last slash in your browser's address bar. This is your node's ID number.
- Now enter the paths to your nodes in the appropriate boxes on your error reporting settings page. For example, if the node ID number for 403 error codes is "83," you would type "node/83" into the "Default 403 (access denied) page" setting.
- Drupal 6
mysite.com/admin/settings/error-reporting - Drupal 7
mysite.com/admin/config/system/site-information
- Drupal 6
Because you are creating nodes, they will show up in the tracker and popular content blocks and anywhere else real nodes would be display. If this isn't acceptable, there is a contributed module called Custom Error that avoids this problem.
Also consider the Drupal 7 contributed module, Redirect 403 to User Login. Which provides redirection to the login page and configurable 403 and 404 error messages.
Comments
410?
Is there a way to report responses other than 403 and 404?
Apache Custom error pages.
Some of these errors can be addressed using custom apache error pages. This would be desirable for 500 errors for example or errors that are out of the Drupal realm.
Visit me www.pacificsimplicity.ca | Drupal services & Design, 3d Autodesign and Howtos.
"ErrorDocument" row in .htaccess linking to node with error text
Please can you give an example for solving all the other errors one wants to be included:
1. Having made a node for each one of the errors with error sentence and helping text for your surfers (all of this for each drupal multisite)
For example:
/sites/subdomain.domain.de.specification/themes/specification/node/250
/sites/subdomain.domain.de.specification/themes/specification/node/251
2. And now am making a .htaccess file (for each drupal multisite) with
ErrorDocument 401 ?...?
ErrorDocument 500 ?...?
?...? which information is to be given here?
Custom 404 error page doesn't show up - Need help
Hi there,
I'm on D 6 and i have follow the 3 steps above but my custom 404 page doesn't show and still get the old 404 error page ! Also my left and right bloc disappear !
Am i missing something ?
your help will be appreciate
I'm willing to avoid the solution of installing another module if i can just specify this in mysite.com/admin/settings/error-reporting !
thanks
I'm having the same issue...
Where you able to find a solution?Literally two minutes later I ran across this: http://drupal.org/node/129762
Thanks!
For Drupal 7
For D7 settings are under Site Information at /admin/config/system/site-information
peter davis : fuzion : connect.campaign.communicate : www.fuzion.co.nz
link 403 to bad address
Hello.
I do a silly thing and now i can't login to my site.
i address 403 to an address that isn't exist. so when i want to login with my user-pass drupal want to redirect to 403 page. because my 403 page doesn't exist site show a 404 not-found and i can't login to site.
if you don't understand my problem: just address 403 page to bad address, that is no exist in site. then log out and try to login.
For example:
Default 403 (access denied) page:
http://your-site.com/asdlknkcjn
--
best regard
thanks drupal. you are lovely!
Go directly to the login page
Log in by navigating directly to the login page:
http://your-site.com/user/login
Internet Marketing Professionals
Works wonderful here!
Works wonderful here!
Works Perfectly
Thanks! This module works perfectly.
Custom theme pages
Hi,
If your are looking for an easy but not so much elegant solution to have custom templates for 403, 404 pages you only need to include this code in your theme template.php and create your templates page-403.tpl.php and page-404.tpl.php:
<?phpfunction mytheme_preprocess_page(&$vars) {
// HACK: Use custom 403 and 404 pages
if (strpos(drupal_get_headers(), '403 Forbidden') !== FALSE) {
$vars['template_files'][] = "page-403";
}
if (strpos(drupal_get_headers(), '404 Not Found') !== FALSE) {
$vars['template_files'][] = "page-404";
}
}
?>
Regards,
Pepe
--
* Pepe *
Avoiding logintoboggan collision
If you are using logintoboggan module you just need to add a few lines more...
<?phpfunction mytheme_preprocess_page(&$vars) {
// HACK: Use custom 403 (avoiding logintoboggan collision) and 404 pages
global $logintoboggan_denied;
if (strpos(drupal_get_headers(), '403 Forbidden') !== FALSE && !$logintoboggan_denied) {
$vars['template_files'][] = "page-403";
}
if (strpos(drupal_get_headers(), '404 Not Found') !== FALSE) {
$vars['template_files'][] = "page-404";
}
}
?>
--
* Pepe *
D7
<?phpfunction YOURTHEME_preprocess_page(&$vars) {
$header = drupal_get_http_header("status");
if($header == "404 Not Found") {
$vars['theme_hook_suggestions'][] = 'page__404';
}
if($header == "403 Forbidden") {
$vars['theme_hook_suggestions'][] = 'page__403';
}
}
?>
http://www.designtn.it