Skip to main content

Python scripted redirects in Plone CMS

Project description

Introduction

collective.scriptedredirect allows you to write HTTP 302 Moved Temporary and HTTP 301 Moved Permanently logic for your Plone CMS site with Python scripting.

Benefits

  • The redirect logic is front-end web server independent (no need to learn Apache, Varnish or Nginx)

  • Python allows to write more complex logic for redirects easier (no regular expressions!)

  • Python scripts in Plone have access to more complete state information (user logged in status, permissions, etc.)

Usage

Add add-on in buildout.cfg:

eggs =
    ...
    collective.scriptedredirect

Run buildout.

Install Scripted redirects in Python in Site Setup > Add-ons.

Edit redirect_handler in Zope Management Interface.

http://cloud.github.com/downloads/collective/collective.scriptedredirect/Screen%20Shot%202012-09-25%20at%201.28.18%20AM.png

In the case of accident use ?no_redirect HTTP query parameter to override the redirecter and fix your site.

Scripting

The redirect script takes input parameters

  • url: full URL of the request

  • host: www.yoursite.com

  • port: 80, 443 or custom Zope port

  • path: the path part of URL

Internals

collective.scriptedredirect hooks itself to Zope’s pre-traversal hook and is triggered before the request traverses into your Plone site in Zope application server.

Author

Mikko Ohtamaa Changelog =========

1.0 (2013-02-05)

  • Initial development [miohtama]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

collective.scriptedredirect-1.0.zip (26.1 kB view details)

Uploaded Source

File details

Details for the file collective.scriptedredirect-1.0.zip.

File metadata

File hashes

Hashes for collective.scriptedredirect-1.0.zip
Algorithm Hash digest
SHA256 31ce4a14cce9e990e6ea9fed314bedc8b9cd76da832894a73ff36be879473555
MD5 0719aa86da3c4a78246b5cf2387f5c61
BLAKE2b-256 f66db5fb086ca7bb339be3f10231a4cc5713a74ac7d5602cf619287ac5f710a4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page