There are various different errors that can be generated by a website. Apache errors (mostly 403 and 404), SQL errors, and PHP errors. A 403 error is generated when access to a page is denied. A 404 error is generated when a page is not found on the server. All errors are logged in an error log. In drupal, we can define custom pages for 403 and 404 pages.
First we would create a page for 404 errors. To create a page:
- Create content > Page
- For title, type "Page not Found".
- For body, type a custom error message such as "The page you request cannot be found, please re-check the URL"
- Click on the "Publishing options" link at the bottom and make sure that the "Published" checkbox is checked.
- Click on submit
Now look at the url. You would see something like node/1. Jot down this number somewhere.
Now go to:
Administer > Site Configuration > Error Reporting
In the first field, type user. This would redirect the visitor to the log in page whenever, he comes across a page he does not have the rights to access.
In the second field type node/1 or whatever you jotted down from the previous step.
The rest should be pretty self-explanatory.