AOLserver URL Alias Module

Overview

AOLserver/GNNServer/NaviServer 2.0 shipped with a sample C module (with source) - alias - that allowed one to define URL aliases in the config file. In AOLserver 2.1, this functionality was built-in.  In AOLserver 3.x/4.x, this was again removed, so we've ported the 2.0 sample to 3.0/4.0 with minor modifications. Among other things, the alias module allows you to also easily bring back the /NS/Asset URL alias used by AOLserver 2.x's administration pages.

Installation & Configuration
Installation is the same as for any other AOLserver module: place the complied alias.dll/alias.so into the bin directory and in the config file under ns_section "ns/server/$server/modules" add ns_param alias ${bindir}/alias${ext}

Now add the desired aliases configuration parameters for this virtual server, i.e.:

ns_section "ns/server/$server/aliases"
ns_param "NS/Asset" "d:/web/Asset"

You may also need to add an entry to your servers/$server/modules/nsperm/perms file:

allowgroup inherit GET /NS/Asset all

Next restart your AOLserver, check your Server Log - it should have an entry like this:

Notice: Ns_ModuleInit($server,alias): Mapping /NS/Asset to d:/web/Asset

Test access to /NS/Asset/somefile - it should serve d:/web/Asset/somefile.  Also ns_url2file /NS/Asset/somefile should return d:/web/Asset/somefile.

Implementation

The original AOLserver 2.x documentation and source for the module can be seen here.

We made the following modifications to it:

  • Look for aliases in ns/server/$server/aliases rather than ns/server/$server/modules/alias. This maintains backwards compatibility with the built-in alias mechanism in 2.1.

  • Added an Ns_GetUserHome procedure for Win32 as AOLserver 3.2 Win32 doesn't include that procedure in nsd.lib

URL Aliases | amattributes2set | ampools | ADP Master Pages
 

© Copyright 1996-2014 by am.net and Solitex Networks. Legal Notices.
Creative Commons License Articles on this site are licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.