Zope Page Redirection
There are a number of ways to redirect users to a different URL. Here's a quick survey of some of them.
Using a "redirects" folder and the engineering "wrap"
If your site uses the standard engineering "wrap" (templating system) that the college and school sites employ, there's a built-in mechanism. Start by adding a subfolder named "redirects" (all lowercase) to the location where the URL that is going to be redirected would be pointing, then add a string property to the redirects folder. The name of the property is the filename at the end of the URL that is being redirected, and the value is the full URL of the page to which you want to redirect the requests.
Note that this will only work if the page or file does not actually exist at the old URL. The redirects folder is only consulted if the requested page can't be found, so if the page exists at the old URL, then the redirect you set up will never be used.
For example, say you want to redirect requests for https://engineering.purdue.edu/Engr/Academics/foo to https://engineering.purdue.edu/Engr/Research/bar because the page has been moved and renamed. You would start by adding a "redirects" folder to /Engr/Academics. (Assuming there wasn't a redirects folder there already.) Then you would go to the Properties tab of the redirects folder and add a string property named "foo", with the value "https://engineering.purdue.edu/Engr/Research/bar".
For any pages on engineering.purdue.edu, the value can be simplified by removing "https://engineering.purdue.edu", which would be "/Engr/Research/foo" in this case. Any locations not on our engineering.purdue.edu server require the full URL.
The rest of the methods mentioned here will work on any Zope site, and don't require our wrap engine.
Another method is to add a python script with the name of the page or file that's being redirected, in the location where that file would have been. Using our example above, you would add a Python script named "foo" in the /Engr/Academics folder. The contents would look like this:
request = container.REQUEST response = request.response response.redirect("https://engineering.purdue.edu/Engr/Research/bar")
That produces a 302 (temporary) redirect. If the page has moved permanently and you want search engines to move the old page's ranking to the new URL, you would use this redirect instead:
This can also be done in a Page Template. This could be handy if you want to temporarily redirect a page that already exists as a Page Template, but plan to reinstate the old page eventually. This way you can keep all the existing code, and the filename, and just do it within the page's code.
To make the magic happen, you just need to add a tal:define variable which has as its value the Python code for the redirect. The definition can be added to an existing tal:define block (preferably on one of the first elements that has one), or you can just add this at the top of the document:
<tal:redirect tal:define="redirect python:request.RESPONSE.redirect("https://engineering.purdue.edu/Engr/Research/bar");" />
DTML Documents and DTML Methods
The same sort of thing can be added to a DTML Document or DTML Method, but the syntax is different:
Last modified: 2017/05/01 11:31:23.299014 GMT-4 by
Created: 2008/02/14 09:36:14.031000 US/Eastern by curtis.f.smith.1.
Type in a few keywords describing what information you are looking for in the text box below.