Installation & Setup - MS SQL
This is the installation guide for the modular release of our
smart 404
404 management script. The most recent release of this script can be downloaded
from the projects
main page.
Although it might look like a complex procedure the installation and setup for our 404 script is
relatively quick & simple; most steps just need you to check that defaults will work for you,
while the remainder are simple one-line changes to tune the script for your website.
How to install and setup your custom 404 script
You'll find a step-by-step guide for installing & setting up your custom 404 error handler
below, the guide has been streamlined so it only contains elements relevant to using
SQL Server
- if you want to view the a different installation guide then they're available via the projects
main page.
-
Unpack the contents of the zip file to your local machine (or your development server if you
can edit files on that machine).
-
Check
StripDefaultDoc() in custom404_common.asp has the
default document names your plan on using - it covers the common default document names
for IIS, so hopefully you shouldn't need to edit it too much unless you've switched to non-defaults.
If you do need to add extra default filenames then just copy & modify a sURI = Replace( ... )
line to match your own setup, replacing the existing filename with your default.
-
Next we need to select the method you plan on using to store the redirects and other rules
for your system so the script can handle requests properly.
Modify custom404-common.asp so that the include on line 1 reads
<!-- #INCLUDE FILE="custom404-mssql.asp" -->.
-
Now we need open up the correct include and make a few small changes so the script will be able
to access the data-source you've chosen to use.
Modify custom404-mssql.asp, editing
Database_Open so that
the connection string (assigned to conDatabase.ConnectionString) has all the appropriate
elements to allow the script to connect to your SQL server. Check the username (UID=),
password (PWD=) and default database (DATABASE=) are valid otherwise
you'll fail to create a connection.
When you've completed the above process open custom404-dbsetup.asp in your
browser to have run the rather simple setup process which will create the main table and associated
indexes. If you encounter an error fix the problem and re-run the script.
-
Finally open custom404-admin.asp and scroll down to line 224. This block of code
provides some protection for the administration page so that not just anyone can access the controls
once the script has been uploaded.
The defaults limit access to the local machine or anyone with the correct password (default: obscurity)
so changing the password would be a good idea. If you have a static IP then removing the password
completely and listing the IP addresses you use instead would be a far better idea in my opinion.
-
All the files that needed modifying should now have been updated so we're ready to upload, you'll
need to copy the following files;
custom404.asp,
custom404.css,
custom404-admin.js,
custom404-common.asp,
& custom404-mssql.asp.
-
Open up your IIS manager or hosting control panel and locate the Custom Errors tab - under
IIS you can find this by viewing the properties of a website with the available tabs going across
the top of the dialog.
When you've found the custom error list scroll down until you find the entry for the 404 and then
replace it with the URL to your newly uploaded 404. Under IIS this requires you to Edit Properties...
on the error you want to change, change the Message Type to "URL" and then key in the path
to your custom 404 script.
-
The script should now be installed. Try to open custom404-admin.asp?pwd=obscurity
(remembering to use the correct password) and hopefully you should now see a list of the example
rules we start you off with.
You should now be able to start adding your own rules into the system, we've tried to make the
online editor as simple as possible but if you find yourself needing extra assistance
then reading the online editor guide may be a good
start.
Further reading
The installation and setup should now be complete leaving you to modify the rules to fit your own
needs - if you need help creating rules via the online editor then have a look at our
online editor guide which gives examples of what each
rule does and how you can use it.
For those feeling adventurous there's also a short guide to enabling semi-transparent
URL rewriting within the script.