Active-Error-Pages icon/logo, a simple slot-wheel, the first showing digits 4 and 5, the second, 0 and 1, and the third, 1, 3 and 4, donating all the different error documents AEP can handle.

Setup Active Error Pages

How to install and setup Active Error Pages..


Installation..

  • Open active-error-pages.php in a decent text editor and edit the preferences section to your own preferred settings.

  • Drop active-error-pages.php into your site somewhere, for example, /err/active-error-pages.php.

  • Direct your site's 404 (and other) errors to this script. This is achieved by editing either your master httpd.conf or site's main .htaccess file, inserting something like this..

    One error page to rule them all..
    ErrorDocument 400 /err/active-error-pages.php
    ErrorDocument 401 /err/active-error-pages.php
    ErrorDocument 403 /err/active-error-pages.php
    ErrorDocument 404 /err/active-error-pages.php
    ErrorDocument 410 /err/active-error-pages.php
    ErrorDocument 500 /err/active-error-pages.php
    ErrorDocument 503 /err/active-error-pages.php

    ..which would direct all 404 and other errors to.. http://yoursite/err/active-error-pages.php which is where I happen to keep *my* copy of this script, that is, inside a folder called "err" in the top level of my site.

    You will have noticed Active Error Pages also handles the other error conditions, 403, 401 and so on. You can set which types you want to handle in the preferences, as well as the responses to send. Once configured in .htaccess, it all happens automatically, Active Error Pages detecting which type of error we are handling and spitting out the correct contents, 401 page, 403 or whatever.

    For more information on .htaccess files, see here. An example .htaccess is included inside the zip distribution.

    Note: On some web hosts you can chose your error pages through the CP (control panel) or site admin page. As a last resort, ask your web site hosts/sysadmin how to achieve this.

  • The optional corzoogle search form (for *very* missing documents) will obviously need to have corzoogle installed somewhere on your site to be of any use. Clearly Active Error Pages is best instructed to use the corzoogle search engine in the 'root', or 'top level' of your site. you can get corzoogle here..

    http://corz.org/server/tools/corzoogle/
  • The "Catchers" part does automatic redirection of your moved pages. Catching requests for outdated resources and redirecting them on-the-fly.

    A simple ini file is used to store your moved pages, no need to hack RewriteRules in .htaccess. moved.ini is a simple plain text ini file..

    Of course, AEP has other, automatic ways of catching these things..
    donate = "/corz/donate.php"
    /blog/index.rdf = "/blog/rdf.php"
    /apache/ = "/server/tricks/"
    htaccess1.php = /server/tricks/htaccess.php
    cshell.stx = "/engine?download=menu&section=windows/EditPlus"
    olive = "/windows/software/checksum/files/checksum-example-log-output-olive.html"
    contact.php = "/corz/contact.php"
    bbtags = "/bbtags"

    Basically:  <old document> = "<new document>"

    On the left, enter some unique string (a partial string is fine) donating the old location (or expected request/typo/etc.), followed by (an equal sign followed by) the exact full path of the new location (from your web root). Putting the targets in "quotes" is a good idea, especially if they contain "=" chatacters (as in query parameters), e.g..

    old-page="/new/page/url.php?foo=bar"

    If the first item is contained *anywhere* within the URL, the redirection will occur immediately. The user usually won't realize they got a 404, unless they look at their address bar.

    As well as automatically redirecting moved files without the need for complex and potentially dangerous mod_rewrite statements, this is handy for catching wonky inward links, user typos, redirecting stupid bots that insit on attempting to load non-existant pages, and much more.

    there's a testing mode which sends 302 Temporary Redirect headers which you can use to ensure everything works as you expect, switching to live mode to send 301 Moved Permanently headers.

    NOTE: Active Error Pages ships with the Catchers in testing mode.


    The idea is, when you move a page, for whatever reason, you add it to the catchers list. Active Error Pages will then permanently (301) direct visitors straight to that page, bypassing the 404 altogether, they won't even realize they *got* a 404! There is also a 302 "testing" mode.

    As well as catching your real moved pages, this can be useful for catching known misspelt inward links (forums!), hot-linkers, and more.

    See inside "moved.ini" for the actual catchers list. Basically a list of old="new" entries. Load it in a decent text editor. A web-based GUI will likely follow at some point.

FAQ

My catcher isn't working! What's up?

Ensure you haven't got another rule, farther up your moved.ini that conflicts with the non-working rule, for example..

foobar="/foo/bar.php"
some/other/path.txt="/this/is/not/relevant.txt"
foobar.php="/bar/foo/"

In this example, a request for /foo/foobar.php will never fire the foobar.php="/bar/foo/" rule because Active Error Pages jumped as soon as it encountered the rule: foobar="/foo/bar.php"

If you switch the order of the two lines around, they will both then work as expected.

And that's it!
You keep your lost visitors now!

Have fun!

;o)

Feedback

If you have a question, feel free to leave a comment, below. I don't expect it to get too busy; Active Error Pages usually just works.


Welcome to the comments facility!


MAINTENANCE MODE!
Posting is currently disabled.

Welcome to corz.org!

If something isn't working, I'm probably improving it, try again in a minute. If it's still not working, please mail me!