Setup Active Error Pages
How to install and setup Active Error Pages..
active-error-pages.phpin a decent text editor and edit the preferences section to your own preferred settings.
active-error-pages.phpinto your site somewhere, for example,
Direct your site's 404 (and other) errors to this script. This is achieved by editing either your master
httpd.confor site's main
.htaccessfile, 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.phpwhich 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
.htaccessfiles, see here. An example
.htaccessis 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..
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
moved.iniis 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§ion=windows/EditPlus"
olive = "/windows/software/checksum/files/checksum-example-log-output-olive.html"
contact.php = "/corz/contact.php"
bbtags = "/bbtags"
<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..
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_rewritestatements, 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 Redirectheaders which you can use to ensure everything works as you expect, switching to live mode to send
301 Moved Permanentlyheaders.
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.
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..
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:
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!
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.