The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.


Apache::AliasList - Apache translation handler to process lists of aliases


In httpd.conf:

 PerlTransHandler Apache::AliasList
 PerlSetVar AliasList /path/to/alias.list

In alias.list:

 # Comment lines ignored
 /alias   /full/uri/spec.html

If http://domain/alias is requested, the document at http://domain/full/uri/spec.html will be delivered.


When using a content management system, it is common for URIs to become quite long and complex. In many cases it is therefore desirable to provide a shorter, more descriptive URI (e.g. to convey verbally or in print).

Apache provides an Alias directive which can be used to make these translations in the httpd.conf configuration file. This approach however has the disadvantage that a server restart is required for any changes to take effect. Apache::AliasList removes this requirement by moving the alias definitions into a separate file which can be updated without restarting the server.

When an incoming request matches one of the listed aliases, an internal redirect is performed - this keeps the original URI in the location bar of the user's browser.

If the incoming request matches the target of any defined aliases, Apache::AliasList will issue an HTTP status 302 response to redirect the client to the source URI of the alias. This has the effect of changing the URI shown in the client browser's location bar


Create an alias.list file:

 # Comments start with '#'
 /old_uri  /location/to/be/redirected/to

Add the following directives to httpd.conf:

 PerlTransHandler Apache::AliasList
 PerlSetVar AliasList /full/path/to/alias.list


There is an alias between the pages and

Accessing the URI will trigger the internal redirect. The address shown in the browser does not change, but the content returned is from the longer URI.

Requesting the page causes the external redirect to be issued, taking the client to This URI will then be processed as described above.


Extend the reverse map feature to act as a content filter, substituting URI links with their aliases in the returned HTML document.


Written by Jon Allen (JJ) <>


Copyright (C) 2004 Jon Allen

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.