[Zope] redirect to a renamed folder
Tim Hicks
tim@sitefusion.co.uk
Fri, 21 Jun 2002 23:41:53 +0100
> Maybe this is what you want:
> http://www.zope.org/Members/gcoelle/LinkedFolder
>
> I haven't tried it.
I haven't tried it either, but my first impression is that it does things
rather transparently. I really want a proper redirect so that the url in
the browser address bar changes. Unless I misunderstand (which I probably
do), this product would seem to give me the same result as the
'PortableHole' product, which was also suggested to me.
thanks for the help though,
tim
> On Fri, Jun 21, 2002 at 07:45:39PM +0100, Tim Hicks wrote:
> > Now I'm pretty sure this is some sort of faq, but I'm really having
trouble
> > doing what I thought would be simple.
> >
> > The Problem:
> >
> > I have a site which needs to have one of its subfolders renamed from
(say)
> > 'foo' to 'bar'. All subfolders within 'foo' (now 'bar') are the same.
No
> > problem so far, but people will have the old url's bookmarked, so I want
to
> > redirect people requesting for example: /site/foo/blacksheep to
> > /site/bar/blacksheep.
> >
> > What I've Tried:
> >
> > I figured I'd user standard_error_message to catch 'NotFound' errors,
and
> > perform a redirect. This is proving more difficult than I'd
anticipated.
> > Here is what I came up with:
> >
> > <dtml-if "error_type">
> > <dtml-if "error_type == 'NotFound'">
> > <dtml-let new_path="_.string.join(_.string.split(error_value,
'/')[2:],
> > '/')">
> > <dtml-call
"RESPONSE.redirect('http://192.168.2.2:9980/test/'+new_path,
> > status=301, lock=1)">
> > </dtml-let>
> > </dtml-if>
> > <dtml-else>
> > missed it
> > </dtml-if>
> >
> > The problem is, this seems to redirect to something looking like
> > http://192.168.2.2:9980/test/H2> (including the >). I guess
'error_value'
> > is not the variable I want. I thought maybe I would want
> > TraversalRequestNameStack, but that doesn't appear right either.
Really, I
> > want a list of url segments so I can drop in my new folder name in place
of
> > the old one, rebuild the url then redirect, but I'm not sure how to do
that.
> > Any ideas?
> >
> > cheers
> >
> > tim
> >
> > ps Another way I thought of was to maintain an empty folder named 'foo'
with
> > an accessrule python script in it that catches the traverse_subpath and
does
> > a redirect, but I'm not sure if that should even work in theory. I
haven't
> > used accessrules before, and I had trouble getting things to work. From
the
> > archives, I found that I can't use RESPONSE.redirect() from an
accessrule,
> > but have to use raise. However, I couldn't get this to work either.
> >
> >
> >
> > _______________________________________________
> > Zope maillist - Zope@zope.org
> > http://lists.zope.org/mailman/listinfo/zope
> > ** No cross posts or HTML encoding! **
> > (Related lists -
> > http://lists.zope.org/mailman/listinfo/zope-announce
> > http://lists.zope.org/mailman/listinfo/zope-dev )
>
> --
>
> Paul Winkler
> home: http://www.slinkp.com
> "Muppet Labs, where the future is made - today!"
>
>
> _______________________________________________
> Zope maillist - Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope-dev )