ArsDigita Archives
 
 
   
 
spacer

Redirects

part of the ArsDigita Community System by Philip Greenspun
Alternative title: "papering over your historical stupidity."

Suppose that you're a stupid person like me and back in 1993 published URLs such as "/~philg/philg". You now want users to get "/philg/index". The redirect subsystem is for you!

Hey, doesn't AOLserver already have an aliases module? Yes, but it assumes that you never move stuff off your server. The ArsDigita Community System redirect module let's you do the following:

  • Redirect "foo" to "bar" (JustOne)
  • Redirect anything that starts with "foo" to "bar" (Inherit)
  • Redirect anything that starts with "foo" to whatever came after the "foo" but starting now with "bar" (Pattern)
You specify redirects in /parameters/ad.ini. All of the work happens in /tcl/ad-redirect

Here's an example:

[ns/server/yourservername/acs/redirect]
Pattern=/~philg|/philg
JustOne=/~philg/new-zealand/nz-mtn-bike.text|/nz/nz-mtn-bike
Inherit=/bp/czech-FAQ|http://www.fas.harvard.edu/~sever/Czech.homepage
The first line ensures that old URLs with a ~philg will still work. It is a "Pattern" redirect spec so that "/~philg/photo/hand-coloring" goes to "/philg/photo/hand-coloring" rather than simply to "/philg".

The second line redirects the user from a .text file in one directory to a file in another redirectory.

The third line redirects anything starting with "/bp/czech-FAQ" to a server at Harvard (the author of this FAQ is a Harvard staff member and it is easier for him to maintain the content there now that Harvard has moved into the Internet Age). You might think that this would be a logical candidate for JustOne rather than Inherit but I wanted to make sure that something like "/bp/czech-FAQ#section1" would also get redirected.


philg@mit.edu
spacer