Creating and managing rules online

This page is part of the extended installation guide for our smart 404 management script and deals with creating and managing rules & redirects through the online administration editor present in the latest modular release - there's also a version of this document for the inline rules module which relies on hardcoded rules.

The most recent release of this script can be downloaded from the projects main page.

Online Editor

Online Editor - Main Screen The screenshot to your right is the front page for the online editor, it offers a very simple set of choices - either create a new rule or redirect, refresh the page or access the details for an existing time with the option to edit or delete that item.

If you need assistance or a little extra insight for creating rules then the basic information on setup, configuration and expected inputs for each rule and redirect can be found below. Hopefully you shouldn't really need this as we've always found the online editor to be rather self-explanatory with just enough client-side "intelligence" to point you in the right direction when something isn't working...

Permanent Redirects - 301

This type of redirect is normally used when a page or similar resource has been moved from a location on your website to another location or a different website and you want everyone to use the new location instead of the old one from this point onwards.

How to create a 301 redirect

Our stock example of a permanent redirect is included with the default rules, viewed via the online editor it looks a little like this...
Online Editor - 301

What does that do? Well the first input is used for matching against incoming URLs, our example would be used if www.yoursite.com/dirB1/myoldpage.htm was requested. Once the request URL was matched then the script would use the value in the second input for the destination URL within the redirect the rule defines. The destination value specified by our example would deliver a redirect to www.yoursite.com/dirB1/mynewdpage.htm.

The first URL is expected to be a normal path from the website root to either a file or folder, as this is matched against incoming requests it must point to a file or folder within your own website - not an external website.
The second URL can either be an internal path, similar to the first, or it can be a fully qualified URL pointing either internally within your website or to another external website.

Temporary Redirects - 302

This type of redirect is normally used when a page or similar resource has been temporarily moved from it's normal location and/or you might still want people to come back to this location in the future rather than going directly to the new location in future as they would with a permanent redirect.

How to create a 302 redirect

Our stock example of a temporary redirect is included with the default rules, viewed via the online editor it looks a little like this...
Online Editor - 302

What does that do? Well the first input is used for matching against incoming URLs, our example would be used if www.yoursite.com/dirA1/ was requested (we store URLs without the trailing slash for easier matching if you were wondering why there was a difference). Once the request URL was matched then the script would use the value in the second input for the destination URL within the redirect the rule defines. The destination value specified by our example would deliver a redirect to www.yoursite.com/dirA2/.

The first URL is expected to be a normal path from the website root to either a file or folder, as this is matched against incoming requests it must point to a file or folder within your own website - not an external website.
The second URL can either be an internal path, similar to the first, or it can be a fully qualified URL pointing either internally within your website or to another external website.

Permanently Removed / Gone - 410

This is one step up from a 404, which is the equivalent of saying "I can't find what you requested, I don't know what's happened to it". On the other hand using a 410 or "Gone" response is a definite response to that request, in effect saying "Whatever you requested doesn't exist on this server anymore and wont be replaced in the future".

How to create a 410 response

Our stock example of a gone response is included with the default rules, viewed via the online editor it looks a little like this...
Online Editor - 410

What does that do? Well the input is used for matching against incoming URLs, our example would be used if www.yoursite.com/dirC1/mydeletefile.htm was requested. If request URL was matched then the script would simply respond with the appropriate 410 Gone header.

The URL is expected to be a normal path from the website root to either a file or folder, as this is matched against incoming requests it must point to a file or folder within your own website - not an external website.

Access Denied - 403

Now and again you'll find you want to respond with a deny to a certain request normally as a subtle hint to the whatever is requesting the resource that they shouldn't bother. Also helps create cleaner logs by filtering out junk requests at the source meaning your site statistics should be a little easier to read.

How to create a 403 response

Our stock example of an access denied response is included with the default rules, viewed via the online editor it looks a little like this...
Online Editor - 403

What does that do? Well the input is used for matching against incoming URLs, our example would be used if www.yoursite.com/dirD1/mypassword.htm was requested. If request URL was matched then the script would simply respond with the appropriate 403 Access Denied header.

Virtual Aliases

Virtual aliases were created to as an extremely simplified and rather ugly cludge to allow URL aliases to be created so when they request file A they are actually served file B. They're very useful when you want to have a script appear to be a different filetype than it really is - for example we use them for delivering XML and RSS content.

How to create a virtual alias

Our stock example of an aliased response is included with the default rules, viewed via the online editor it looks a little like this...
Online Editor - aliases

What does that do? Well the first input is used for matching against incoming URLs, our example would be used if www.yoursite.com/dirE1/simplename.htm was requested. Once the request URL was matched then the script would attempt to transparently execute the script contained in the second input and output the results (if any) to the user. The destination value specified by our example would deliver a redirect to www.yoursite.com/dirE2/longname.asp.

The first URL is expected to be a normal path from the website root to either a file or folder, as this is matched against incoming requests it must point to a file or folder within your own website - not an external website.
The second URL must be an internal path that points to a script the website is able to execute. Paths to external scripts or to any non-file file will result in an error.

For more information read through the URL aliasing guide which explains in more details the uses and mechanics of virtual aliases. If you want to learn more about full rewrites then we have a URL rewriting guide available.
Evolved
Code
ASP, SQL & VB meet the internet.

Navigate

Home Parent Directory Meta-Search

Technical

ASP Scripts SQL Scripts VB Programs Show All

Guides

Show All

Other

Contact Site News About Legal Sitemap Links