Smart 404 Handler
Description
This custom 404 error script is designed to replace the default 404 error page which ships
with IIS and is used whenever a page cannot be found on the website. Aside from providing
the user with a page which looks and feels like an integrated part of the site when a page
cannot be found, it also allows you to transparently move the user to a more appropriate
page if one exists.
Why bother with a custom 404 error page? Well for one it looks more professional when you
get taken to a non-standard error page, secondly since it is non-standard it will offer a user
real advice beyond "sorry, page not found", but most of all it means that the
user stands a better chance of finding what they want which in turn means that they are more
likely to stay on your site.
Features

Supports permanent redirects (301), permanent redirects (302), gone responses (410) and
access denied responses (403), all fully configurable by an administrator. Also supports
basic script aliasing, allowing you to deliver shorter, more memorable URLs for special
pages.
Can be used as a standalone/self-contained script or with a database-driven back-end -
provides modular support for Microsoft Access, SQL Server or mySQL databases (providing
your host supports the database type).
Database-driven installations support our new
online editor
which allows on-the-fly management of all your redirects and rules from your desktop.
Includes support for script-level URL rewrites allowing you to achieve effects similar to
.htaccess or
ISAPI_rewrite
without switching servers or requiring your host to install extra software / DLLs. For
more information see our
URL rewriting guide.
Requirements
- IIS 4 or higher
- Ability to specify custom error handler pages for IIS to use.
- Database support (optional) - Access, MS SQL or mySQL.
Single Compressed Download
Installation & Setup
As the new system is modular there are now a variety of ways to install & setup your script
so to keep it as simple as possible we've created a streamlined install document for each flavour
of the script;
- Single script install - very similar to the previous versions of
the script, a simple edit and upload affair which lacks the flexibility of the newer
modular scripts, meaning it doesn't support the online editor.
- Inline rules - similar to the simple install, still uses
inline rules hardcoded into the script but it gains a little flexibility by using the modular
install allowing it limited access to the online editor.
- MS Access database - the next step up from inline rules,
the database provides improved search functionality and also allows the online editor to be
used fully.
- SQL Server database - the next step up from an Access
database, retains all of the previous abilities (including online editor) but has a far better
ability to scale under load / heavy traffic.
- mySQL database - the next step up from an Access
database, retains all of the previous abilities (including online editor) but has a far better
ability to scale under load / heavy traffic.
User Guide
Because the new system offers a variety of interfaces and methods to control your rules and
redirects we've created several documents which deal with how to get the most out of your
custom 404 error handling script;
- Creating & managing inline rules - discusses the
various types of inline rules & redirects you can implement, how they work and how
to create them.
- Creating & managing rules online - discusses how
various types of rules & redirects you can implement via the online administration
system and how to use the online editor to manage your rules & redirects.
- Testing your script & rules - a basic primer
on how to test your script and the current rules directly without fully integrating
the 404 script with your server.
- Using virtual aliases - a primer on virtual aliases,
what they do, when you could use them, when you could use something better to do the same
job and the limitations of the technology powering virtual aliases.
- Enabling URL rewriting - an advanced topic that
discusses how you can use your 404 error handler to perform basic URL rewriting.
Additional Notes
If you are being redirected to the custom 404 error handler and the URL looks similar to
"/my404script.asp?404;http://www.example.com/foo.asp") this isn't a fault with
our script, it relates to the way IIS handles certain extensions.
Aside from looking a little messy at times it isn't really a major problem as it wont
impact either your users or the search engines. But if you feel you want to fix it then
it's relatively simple and involves a single IIS configuration change which corrects the
problem - although once again I should point out the intermediate redirect doesn't seems
to cause any problems that I'm aware of with either users or search engines.
- Open the IIS Manager console.
- Access the properties for your website.
- Click the "Home Directory" tab.
- Click the "Configration..." button.
- Select ".asp" and click the "edit" button.
- Ensure the "Check file exists" checkbox is enabled.
- "Ok" the dialogs you've just opened.
Related Links
-
Anti Hotlinking Enhancements, a script designed as a companion to our 404
error handler which enables IIS to stop certain images being hotlinked without requiring an ISAPI component.