[Zope] efficient internal redirect

Alexander Staubo alex@mop.no
Mon, 13 Mar 2000 11:44:07 +0100


> Whilst this is I'm sure a useful mechanism redirecting
> whole folders is overkill for what I need to do.  I have
> many links into a tree and wish to have a very simple format
> for the external links and an internal mapping mechanism
> which maps each link to its real URL.  My question remains.
> What's the most run-time-efficient (not development-time-efficient)
> way of doing it?  I think you gave me the quickest development
> route which is not quite what I was asking.

Why can't they be the one and the same? Redirector is fast -- I suspect
the difference in speed between Redirector and something else would be
negigible.

Remember that a Redirector folder is in itself just an index (of
regexps -- it's not hard to wire the lookup so that, if the term is not
a regexp, then it will use a dictionary, which is a lot faster). It does
not need to contain anything, and you need only one Redirector folder to
accomplish what you ask for. Let's say you have three areas that others
link to: Downloads, Registration, and News. First, create a Redirector
folder called, say, /Targets. Then edit the folder's redirection
mappings to look like so:

	From                   To
	Downloads              /Downloads
	Registration           /Snark
      News                   /News

Notice that the Registration name maps to /Snark -- this to illustrate
the mappings have nothing to do with the *names*. Now, having done this,
you can access your mappings like so:

	http://www.myserver.com/Targets/Downloads

which will redirect to

	http://www.myserver.com/Downloads

Isn't this what you want?

Alexander Staubo
mailto:alex@mop.no
http://www.mop.no/~alex/