Skip to content. | Skip to navigation

Personal tools
Sections
You are here: Home wiki redirect

redirect

Prerequisities

Via Charles Witt's post on plone.org

You of course need to have the "Manager" role for your Plone site.

Step by step

Go to:

Site Setup

ZMI

Note, folders created with the user view of the website (TTW) won't work.

You need to create the folder as a plone.app.folder: folder and check ATFolder when you give it an Id.

In the folder that you want a redirect to be triggered, click the dropdown:

Select type to add

Script (Python)

For Id, give a descriptive short name (no spaces), leave File blank

Click: Add and Edit

Leave blank the Title and Parameter List

Copy Paste the following into the body (replacing its contents):

## Script (Python) "redirect.py"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=Redirects to a default folder
##
container.REQUEST.RESPONSE.redirect(context.portal_url()+'/projects')

 

Replace the '/projects' part with the path to the specific url you want to redirect to.

Can redirect to an external site with something like

container.REQUEST.RESPONSE.redirect('http://www.ucd.ie/mis')

Click Save Changes

Click the Properties tab

Change or Add the default_page property to: redirect.py

Click Save Changes

Now go view that folder in the regular Plone view, publish the folder and test that it redirects.