: TipsAndTricksApacheErrorHandling

Welcome :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register

Handling server errors


Several options exist for handling web server errors, for example, to define what happens when a webpage is requested that does not exist. Rather than show an ugly error it's common to display something useful and/or pretty.

Default


The default method, when using the "Error Pages" option in the Control Panel, are SSI files. This creates files for each type of http error. See the Control Panel for additional details and use.

Others


It may be desired to write these error handlers in a different language, such as PHP, and here's how:

Using .htaccess


This example will assume a PHP error handler, and assume the root directory of the domain. The filenames of these files can be anything you choose. So within .htaccess place the (or an edited version of) the following:

  ErrorDocument 404 /404.php

Now all 404 errors (requests for missing files) will redirect to a file named 404.php and then this file (404.php) can do whatever you wish like show a sitemap, or simply say "Sorry." Each domain or subdomain can have their own.

There are no comments on this page. [Add comment]

Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by Wikka Wakka Wiki 1.1.6.2
Page was generated in 0.0479 seconds