Skip to the content Back to Top

Andornot has long recommend using canned queries into your databases as a means of surfacing information for users. On a web-accessible database, a canned query takes the form of a URL with some search terms in it that retrieve records from the database with a single click. Common uses are to retrieve:

  • new items added to a database, such as the latest books catalogued in a library, or latest legal memos in a law firm database;
  • items on a particular subject in a library catalogue, or a finding aid for a particular archival fonds;
  • a list of all journals, maps, DVDs, etc. in a library catalogue.

By constructing the search for the user, we can guide them towards new, interesting or relevant resources in a collection, and help new users in particular to quickly and easily see what the database contains. From there, users can begin their own searching, knowing what sort of information and keywords to use.

Andornot provides a web-based Search Cannery Wizard to help you construct URLs that will search your database. By filling in fields on this form, you can create a URL such as the following, which searches the sample library catalogue database included in our Andornot Starter Kit for all the journals:

This is a very useful URL to be able to give a user. This one in particular can be given to new staff to ask which titles they’d like routed to them. There are just a couple potential problems with the URL:

1. It’s long and in some email clients, the text will wrap to a second line and the link will be broken.

2. The URL isn’t easily read to decipher what it might lead to (unlike, say,, which can be predicted to lead to our website).

URL Rewriting

A great solution to these two issues is to use a technique known as URL rewriting to replace the lengthy URL with a shorter, friendlier one, such as

This short URL is easily read and can be predicted to lead to a list of journals in the starter kit sample database.

A short URL like this can be emailed to colleagues or published on an intranet. When the web server receives a request for this “page” in the website, it translates it into the longer URL that performs the canned query. This all happens behind the scenes, so while the user immediately sees the list of journals, only the friendly URL remains in their browser address bar.

The permalink portion of the URL is a common term used to indicate that the URL will be around for a while and the user can reliably bookmark it. Though it’s not strictly necessary, it helps to differentiate these types of URLs from ones that correspond to folders in the website.

URL rewriting is also a great technique for linking to specific records in a database. For example, this short URL Record leads to the catalogue record for the Architectural Record journal. The link can be generated using the unique ID or number that every record in a database should have, and a rewrite rule that translates it into a search.

Real-World Examples

The Law Society of Saskatchewan Library has a series of short, friendly URLs set up to retrieve the latest works from their catalogue in different legal practice areas. The URLs also correspond to the RSS feeds set up in the same way. Both provide a means for lawyers to stay abreast of new items of interest to them, whether by bookmarking a short URL, or by subscribing to the RSS feed.

Here are a few examples:

More are listed on this page, along with the RSS feeds (which are described in detail in this blog post).

The Provincial Resource Centre for the Visually Impaired (PRCVI) runs most of their website content from an Inmagic database (we blogged about this here). We recently replaced lengthy canned query URLs with short, friendly ones, such as:

These URLs are easily emailed to the students and teachers that PRCVI serves, yet always retrieve the latest information from their database.

Detailed instructions for setting up URL rewriting is provided below for DIY types who like to roll up their sleeves and get hands-on with their server. If you’d like our assistance, please contact us – we’d be happy to help you take advantage of this simple technique to improve service to your users.


URL Rewriting – How To Do It

diyCaution: technical jargon ahead!

URL rewriting can be set up in IIS, the Microsoft web server, quite easily. In IIS 7, for example, you would download and install the URL Rewriting module from Microsoft, if it’s not already installed, then set up rewrite rules such as this one:



<rule name="Journals">

<match url="^permalink/journals" />

<conditions logicalGrouping="MatchAll" />

<action type="Rewrite" url="/results.aspx?AC=qbe_query&amp;TN=starter&amp;RF=WebBrief&amp;DF=WebFull&amp;DL=0&amp;RL=0&amp;NP=255&amp;MR=10&amp;QY=find+MaterialType+=Journal" />




As you can see, this rule takes an incoming URL that matches this


and translates it to this


which is a canned query into a sample database that finds all records which are journals.

Note that you could still use the Andornot Search Cannery Wizard to construct this URL.

Here’s one that can take a URL that includes a unique record ID and a title, such as Record and translate it into a search for a specific record in the database, using a regular expression (RegEx), to parse the ID and title from the URL .

<rule name="Permalink">

<match url="^permalink/([0-9]+)/(.*)" />

<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />

<action type="Rewrite" url="/results.aspx?AC=qbe_query&amp;TN=starter&amp;RF=WebFullPURL&amp;DF=WebFullPURL&amp;DL=0&amp;RL=0&amp;NP=255&amp;MR=10&amp;QY=find+RecordId+%3d{R:1}" />


In the above, the title is discarded and the unique record ID is used as a parameter in a search.

Rewrite rules can be added through the IIS management console GUI, or simply by editing your web application’s web.config.

You can learn more about the IIS 7 URL Rewrite module and download it here.

In IIS 6, we recommend using the open-source URL rewriting module available from Instructions are provided for installing and configuring the module and making appropriate entries in your web application’s web.config file. Once installed, rules similar to those shown above for IIS 7 may be used. For example, this rule can be used to link to a specific record in a database.

<urlrewritingnet defaultPage = "default.aspx" xmlns="" >


<add name="Permalink" virtualUrl="^~/permalink/([0-9]+)/?default.aspx"



ignoreCase="true" />



Other Rewrite Rules

In addition to rewrite rules to link to a specific record and to replace long canned query URLs, we recommend that you set up two more additional rules, to add or remove trailing slashes, and to convert all URLs to lower case.

To a human and a web server, and are similar, but to a search engine, they are quite different. It's a good idea to set up a rule to consistently add or remove the trailing slash, to improve search engine ranking.

The same applies to mixed upper and lower case in URLs – it’s a good idea to enforce all lower case so that the page appears as one to a search engine. Examples of these rules may be found here:

Let Us Help You!

We're Librarians - We Love to Help People