Mod_rewrite RewriteMap prg

Posted on 2005-04-11
Last Modified: 2008-01-09
Hi all,

I am trying to make RewriteMap work but I have no luck I guess..

I have Apache 1.3.33 on Linux and

RewriteEngine On
RewriteMap testprg prg:/home/www/giveOutputPerl
RewriteLock /tmp/giveOutputPerl_lock
RewriteBase /
RewriteRule ^testmatch/(.*) /test.php?t=${testprg:$1}

in httpd.config

and giveOutputPerl is:

$| = 1;
while (<STDIN>) {
    # ...put here any transformations or lookups...
    print $_;

which is perfercly working stand alone.

The problem is on rewritelog I get is:
map lookup FAILED: map=giveOutputPerl key=asdasasdasd

is there any ideas???

I also dug deeper.
I debugged the mod_rewrite.c and found out the parameters calling :

static char *lookup_map_program(request_rec *r, int fpin, int fpout, char *key)
fpout is -1 and I get this error.
why fpout becomes -1

Any ideas?


Did you guys every run rewritemap prg, on any late version of apache except 2.x?

Best Regards,

Question by:argiope
    LVL 27

    Accepted Solution

    Where dod you use the rules?

    You cannot use
    RewriteMap testprg prg:/home/www/giveOutputPerl
    RewriteLock /tmp/giveOutputPerl_lock
    in a .htaccess or inside <Directory>, which seems to be the case. Put it in a <Virtualhost> or in your main server config section.

    If you place all rules in <Virtualhost> or in the main server config section, make sure the pattern of the rule has a leading slash:

    RewriteEngine On
    RewriteMap testprg prg:/home/www/giveOutputPerl
    RewriteLock /tmp/giveOutputPerl_lock
    RewriteRule ^/testmatch/(.*) /test.php?t=${testprg:$1} [L]

    Author Comment

    thanx caterham_www

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
    If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now