httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike F. @ LabJack" <>
Subject [users@httpd] mod_rewrite: External RewriteMap program never gets input
Date Fri, 24 Jun 2011 21:10:40 GMT

I am attempting to use an external program in RewriteMap. It seems that no
matter what I do, data never makes it to my program. 

I'm on an Ubuntu 11.04 machine, running Apache 2.2.17.

My /etc/apache2/sites-available/mynewsite looks like this:
RewriteEngine On
RewriteLock "/var/run/rewrite-lock.lock"
RewriteMap rmsp "prg:/usr/local/bin/"

My .htaccess file looks like this:
RewriteEngine On
RewriteBase /
RewriteRule foo/([^/]*) /bar/${rmsp:$1}/feed [R=301,L]
#!/usr/bin/python -u

import sys
import logging
logging.debug('rmsp started.')

while True:
    logging.debug('Waiting for input...')
    data = sys.stdin.readline()
    logging.debug('Data recieved: %s' % data )
    if data:
        logging.debug('printing: %s' % data )
        print data,
        logging.debug('eof. Breaking...')

When I look at the log, I see:
DEBUG:root:rmsp started.
DEBUG:root:Waiting for input...

So, for some reason, my program is never getting any data. When I turn on
Rewrite logging, I don't see the "map lookup OK: map=rmsp key=stuff ->
val=stuff". It just does this: - - [24/Jun/2011:13:11:17 --0600]
[][rid#7f9c98ed6fb0/initial] (3)
[perdir /home/user/vhost/] applying pattern 'foo/([^/]*)' to uri
'foo/ilovekittens' - - [24/Jun/2011:13:11:17 --0600]
[][rid#7f9c98ed6fb0/initial] (2)
[perdir /home/user/vhost/] rewrite 'tag/ilovekittens' -> '/bar//feed' - - [24/Jun/2011:13:11:17 --0600]
[][rid#7f9c98ed6fb0/initial] (2)
[perdir /home/user/vhost/] explicitly forcing redirect with

I've tried using the internal function "int" mapping, and that works.

Any ideas on what I'm doing wrong? Is there other information that is

View this message in context:
Sent from the Apache HTTP Server - Users mailing list archive at

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message