rewrite

name: rewrite
author: Steven Armstrong
home page: http://www.c-area.ch/code/
download: http://www.c-area.ch/code/pyblosxom/plugins/
license:
category: headers
tags:
last edited: Feb 20, 2013 (Wednesday)

Request rewrite plugin. Similar to Apache mod_rewrite.

Sends a '301 Moved Permanently' status code allong with the new location of the resource.

Generates a simple html page with a meta-refresh and a link to the new resource as a fallback version for clients that do not understand http header redirects.

Configurable through a variable in config.py:

py['rewrite_rules'] = {
  '^/old$': r'/new', 
  '^/olddir/(.*)': r'/newdir/\1',
  '^/nothere/(.*)': r'http://www.example.com/here/it/is/\1'
}