RewriteRule ^(.*)/(intl|de)/(.*) $1/jsp/$3 [QSA]
RewriteRule ^/$ /app/jap/home.jsp/23323.html [NS,R,L]
RewriteMap shortnames txt:/etc/apache/shortnames.txt
RewriteCond %{REQUEST_FILENAME} ^/[a-zA-Z0-9]+/?$
RewriteRule /([a-zA-Z0-9]+)/? ${shortnames:$1} [T=text/html,R,L,NS]
RewriteRule .*/favicon\.ico$ /statics/favicon.ico [PT]
RewriteRule ^/s\.gif$ /statics/pics/space.gif [PT]
RewriteRule ^/robots.txt$ /statics/robots.txt [NS,PT]
#pictures vom cms-server
RewriteRule ^/pictures/(.*) http://cms-dev/pictures/$1
# This one has to be the last in row:
RewriteRule ^(.*)_jsp(.*)$ $1.jsp$2 [QSA]
<Location /app/jsp>
SetHandler default-handler
</Location>
# serve static files:
<Location /app/jsp>
SetHandler perl-script
PerlHandler Apache::StaticServer
</Location>
Some lines from the .pm. Its purposeis to serve a static file instead of the requested jsp. For instance, if I send a request for
something like "/app/jsp/category.jsp/23323" or "/app/jsp/category.jsp/23323.html" the handler has to look after a file named
%{DOCUMENT_ROOT}/app/html/category_jsp/23323.html, and if it doesn't exist, decline.
$catid = $r->path_info || "/23323"; # ancient rewrite rule
$fname = $r->filename;
$fname =~ s/.jsp$/_jsp/;
$fname =~ s:/jsp/:/html/:;
$fname .= $catid;
$fname .= ".html" unless $fname =~ /\.html$/; $r->log()->debug($fname."\n".$r->filename);
$fh = Apache::File->new($fname) || return DECLINED;
$r->header_out('Content-Length', -s $fname);
$r->update_mtime((stat $fname)[9]);
$r->send_http_header;
$r->send_fd($fh);
close $fh;
OK;
Here's a line from error_log which comes from the $r->log()->debug(...) verse and says exactly what it has to:
[Tue Feb 12 15:03:55 2002] [debug] /usr/local/share/perl/5.6.1/ApacheStaticServer.pm(37): [client 192.168.255.75] /home/disp05/app/html/category_jsp/67567.html
/home/disp05/app/jsp/category.jsp
If I send a request trhough a simple LWP client, here's what it says:
./client.pl http://disp05/app/jsp/category.jsp/67567
500 (Internal Server Error) unexpected EOF before status line seen
Client-Date: Tue, 12 Feb 2002 13:57:18 GMT
Ans this is what I find in my rewrite_log:
192.168.255.75 - - [12/Feb/2002:15:03:55 +0100] [disp05/sid#80aec3c][rid#81b1154/initial] (2) init rewrite engine with requested uri /app/jsp/category.jsp/67567
192.168.255.75 - - [12/Feb/2002:15:03:55 +0100] [disp05/sid#80aec3c][rid#81b1154/initial] (3) applying pattern '^(.*)/(intl|de)/(.*)' to uri '/app/jsp/category.jsp/67567'
192.168.255.75 - - [12/Feb/2002:15:03:55 +0100] [disp05/sid#80aec3c][rid#81b1154/initial] (3) applying pattern '^/$' to uri '/app/jsp/category.jsp/67567'
192.168.255.75 - - [12/Feb/2002:15:03:55 +0100] [disp05/sid#80aec3c][rid#81b1154/initial] (3) applying pattern '/([a-zA-Z0-9]+)/?' to uri '/app/jsp/category.jsp/67567'192.168.255.75 - - [12/Feb/2002:15:03:55 +0100] [disp05/sid#80aec3c][rid#81b1154/initial] (4) RewriteCond: input='/app/jsp/category.jsp/67567' pattern='^/[a-zA-Z0-9]+/?$' => not-matched
192.168.255.75 - - [12/Feb/2002:15:03:55 +0100] [disp05/sid#80aec3c][rid#81b1154/initial] (3) applying pattern '.*/favicon\.ico$' to uri '/app/jsp/category.jsp/67567'
192.168.255.75 - - [12/Feb/2002:15:03:55 +0100] [disp05/sid#80aec3c][rid#81b1154/initial] (3) applying pattern '^/s\.gif$' to uri '/app/jsp/category.jsp/67567'
192.168.255.75 - - [12/Feb/2002:15:03:55 +0100] [disp05/sid#80aec3c][rid#81b1154/initial] (3) applying pattern '^/robots.txt$' to uri '/app/jsp/category.jsp/67567'
192.168.255.75 - - [12/Feb/2002:15:03:55 +0100] [disp05/sid#80aec3c][rid#81b1154/initial] (3) applying pattern '^/pictures/(.*)' to uri '/app/jsp/category.jsp/67567'
192.168.255.75 - - [12/Feb/2002:15:03:55 +0100] [disp05/sid#80aec3c][rid#81b1154/initial] (3) applying pattern '^(.*)_jsp(.*)$' to uri '/app/jsp/category.jsp/67567'
192.168.255.75 - - [12/Feb/2002:15:03:55 +0100] [disp05/sid#80aec3c][rid#81b1154/initial] (1) pass through /app/jsp/category.jsp/67567
192.168.255.75 - - [12/Feb/2002:15:03:55 +0100] [disp05/sid#80aec3c][rid#81b5494/subreq] (2) init rewrite engine with requested uri /67567
192.168.255.75 - - [12/Feb/2002:15:03:55 +0100] [disp05/sid#80aec3c][rid#81b5494/subreq] (3) applying pattern '^(.*)/(intl|de)/(.*)' to uri '/67567'
192.168.255.75 - - [12/Feb/2002:15:03:55 +0100] [disp05/sid#80aec3c][rid#81b5494/subreq] (3) applying pattern '.*/favicon\.ico$' to uri '/67567'
192.168.255.75 - - [12/Feb/2002:15:03:55 +0100] [disp05/sid#80aec3c][rid#81b5494/subreq] (3) applying pattern '^/s\.gif$' to uri '/67567'
192.168.255.75 - - [12/Feb/2002:15:03:55 +0100] [disp05/sid#80aec3c][rid#81b5494/subreq] (3) applying pattern '^/pictures/(.*)' to uri '/67567'
192.168.255.75 - - [12/Feb/2002:15:03:55 +0100] [disp05/sid#80aec3c][rid#81b5494/subreq] (3) applying pattern '^(.*)_jsp(.*)$' to uri '/67567'
192.168.255.75 - - [12/Feb/2002:15:03:55 +0100] [disp05/sid#80aec3c][rid#81b5494/subreq] (1) pass through /67567
Lots to read I know. Hope you'll have the patience.
Many thanx in advance,
best regards
Martin
Geoffrey Young wrote:
[EMAIL PROTECTED]">Martin Haase-Thomas wrote:Hi,
I searched in the book, I searched in the FAQs - no I ask u:
Does Apache::File->new start a subrequest?
no. it is merely a layer over Perl's file IO methods (Perl_do_open
from what I can see).There are some mystical lines
in my rewrite_log, which might come from there.
that seems strange. maybe post the lines if they are causing you
grief..
HTH
--Geoff