[Prev][Next][Index][Thread]

Re: Redirection in CL-HTTP



On Thu, 11 Jan 96 16:41:43 PST, Bob Kanefsky wrote:

>How do I redirect requests for an entire URL tree in CL-HTTP?
>NCSA's httpd has a Redirect directive
>        (see http://hoohoo.ncsa.uiuc.edu/docs/setup/srm/Redirect.html)
>that works on everything below a certain point.  But when I try to do
>it the obvious way in CL-HTTP 53.7, 
>
>(export-url #u"/Old/Stuff/"
>            :redirect
>	    :recursive-p t
>            :expiration `(:interval ,(* 15. 60.))
>	    :alternate-urls #u"http://new-server/New/Home/")
>
>the result is that /Old/Stuff/ is redirected to http://new-server/New/Home/
>but /Old/Stuff/foo/bar is not redirected to http://new-server/New/Home/foo/bar.

The reason :rescursive-p doesn't work with :redirect is that for an
export to be recursive, it needs a structure to walk down and get data
from (like the file system.)  When you redirect a url, you are
creating a path from the alternate-urls you entered.

I see some problems with having a redirect automatically apply to a whole 
subtree.  NCSA provides these instructions:

>Redirect /dir1 http://newserver.widget.com/dir1 
>
>This would cause requests for /dir1 to be redirected to the new location,
>http://newserver.widget.com/dir1. 

A request for a directory is a separate url in itself, and should be able 
to be redirected alone.  For example, I might want to redirect
/cl-http/cvince/ to a homepage on my personal machine, but have
/cl-http/cvince/cl-hacks/ be a normal directory on the cl-http server.

The obvious option is to export a redirect for every document you want
to point to.  Otherwise, in order to maintain the ability in my
example, you would need to modify the condition handling for
'document-not-found (404) to first check to see if a superior
directory has been redirected.  This would produce the desired effect,
but doesn't really conform to the model.  Again, take the example I
gave above.  All of a sudden you're getting 404 errors from my personal
machine when you actually mispelled a url in
/cl-http/cvince/cl-hacks/.

Christopher Vincent
cvince@ai.mit.edu


References: