[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1112
  • Last Modified:

Mod_rewrite RewriteMap prg

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:

#!/usr/bin/perl
$| = 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?

Also

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

Best Regards,
Ron.

0
argiope
Asked:
argiope
1 Solution
 
caterham_wwwCommented:
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]
0
 
argiopeAuthor Commented:
thanx caterham_www
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now