Mikko Ohtamaa
Mikko Ohtamaa

Reputation: 83818

Redirects on Plone

What's the recommended way to do HTTP redirects on Plone using Python? What hooks are available? Can redirects managed through ZMI? My guess is that there is per site pre-traverse mechanism which allows you to check URL and intercept the request if it looks a redirect is needed.

We have some complex redirecting rules and it does not make sense to put them to Apache/NGINX.

Upvotes: 2

Views: 2142

Answers (4)

Felipe G. Nievinski
Felipe G. Nievinski

Reputation: 494

If you're not allowed to install anything new, you can use the underlying Zope to create a redirect via a Python script, see details.

Upvotes: 0

Mikko Ohtamaa
Mikko Ohtamaa

Reputation: 83818

In the end this was the code I needed:

http://opensourcehacker.com/2011/08/03/python-based-http-redirect-rules-with-plone/

Unfortunately none of existing add-ons allowed to write redirect logic in Python in such simple manner.

Upvotes: 1

fRiSi
fRiSi

Reputation: 1238

not sure if http://plone.org/products/redirectiontool/ is the same as http://pypi.python.org/pypi/Products.RedirectionTool. the changelog and releasedates look different. it might be worth a try

Upvotes: 1

Alex
Alex

Reputation: 4345

Maybe you can do something with: http://pypi.python.org/pypi/plone.app.redirector. RedirectionTool uses this technology to allow TTW management of content that has been renamed in Plone. But I assume you could use it for whatever complex redirects you need to do in Python.

There is also:

And:

I agree it might be nice to have Plone handle redirects that are not strictly related to content (assuming this is what you mean by "complex redirecting")

Upvotes: 4

Related Questions