Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: RewriteMap prg: fail to launch on Windows |
|
Author |
|
sunils
Joined: 27 Sep 2007 Posts: 1
|
Posted: Thu 27 Sep '07 19:04 Post subject: RewriteMap prg: fail to launch on Windows |
|
|
Helo everybody,
I was trying to do a simple url rewrite using RewriteMap with external program (Apache 2.2.4 on WinXP). How ever the externam program some how is never launched by Apache. There is no error in the error log, eventlog etc. rewrite.log says "map lookup FAILED". The program specified in RewriteMap prg: is never getting executed.
Here is the relevant part of my httpd.conf :
------------------------
Alias /vfolders "D:\vfolders"
RewriteLog logs/rewrite.log
RewriteLogLevel 9
RewriteMap testmap "prg:c:/perl/bin/perl.exe c:/Apache2/bin/rewritemap.pl"
<Directory "D:/vfolders>
Options Indexes Multiviews FollowSymLinks
Order allow,deny
Allow from all
AuthType Basic
AuthName "Nothing"
AuthBasicProvider file
AuthUserFile conf/passwd
Require valid-user
RewriteEngine on
RewriteBase /vfolders/
RewriteCond ${testmap:%{REQUEST_URI}:%{REMOTE_USER}} ^REWRITE$ [NC]
RewriteRule ^.*$ /vfolders/%{REMOTE_USER} [R,L,NS]
</Directory>
------------------------
Here is the listing of rewritemap.pl
------------------------
#!c:\\perl\\bin\\perl.exe
$|=1;
while(<STDIN>){
chomp; my ($URI,$USER)=(split /:/);
if ( $URI=~/^\/vfolders\/$USER/ ) {
print "NOREWRITE:$URI:$USER\n";
} else {
print "REWRITE:$URI:$USER\n";
};
}
------------------------
Here is an edited portion of rewrite.log when I try to fetch
curl -v -I -u sunils:password http://localhost/vfolders/shruthi/
------------------------
18:57:21 initial (3) [perdir D:/vfolders/] strip per-dir prefix: D:/vfolders/shruthi/ -> shruthi/
18:57:21 initial (3) [perdir D:/vfolders/] applying pattern '^.*$' to uri 'shruthi/'
18:57:21 initial (5) map lookup FAILED: map=testmap key=/vfolders/shruthi/:sunils
18:57:21 initial (4) [perdir D:/vfolders/] RewriteCond: input='' pattern='^REWRITE$' [NC] => not-matched
18:57:21 initial (1) [perdir D:/vfolders/] pass through D:/vfolders/shruthi/
18:57:21 subreq (1) [perdir D:/vfolders/] pass through D:/vfolders/shruthi/index.html
------------------------
As seen above, key for the look up has been correctly evaluated, but perl script never gets executed. I have tried compiled version of the script also, but result is same.
Any clue?
TIA
Sunil |
|
Back to top |
|
James Blond Moderator

Joined: 19 Jan 2006 Posts: 7389 Location: EU, Germany, Next to Hamburg
|
|
Back to top |
|
|
|
|
|
|