On 8/12/05, Joshua Slive <[EMAIL PROTECTED]> wrote:
> On 8/12/05, Tony VanScoy <[EMAIL PROTECTED]> wrote:
> > First here is my config for a VirtualHost
> >
> > # map id's to actualy filenames
> > RewriteMap fileName prg:/home/user/getFileName.php
> >
> > # catch any pdfId as long as it's an integer
> > RewriteCond %{QUERY_STRING} ^pdfId\=\d+$
> >
> > # only rewrite for test.php, but substitute the entire
> > URL+QUERY_STRING with the file location
> > RewriteRule ^/test\.php$ /pdf/${fileName:$1}? [R,L]
> >
> >
> > That does not work. I'm very new to this.
> >
> > 1) I'm assuming that $1 in RewriteRule represents the \d+ in the
> > RewriteMap. Please correct me if I'm wrong.
>
> Use %1 for back-references to RewriteCond. $1 is a back-reference to
> the RewriteRule.
>
> > 2) It seems that the mapping only occurs the first time it's called.
>
> Yes, it is probably a problem with getFileName.php. You also don't
> have a RewriteLock directive. And you should be using the RewriteLog
> to pinpoint problems.
>
> Joshua.
>
It kind of works. I made the change to %1 and when I made a request ...
/test.php?pdfId=12
.. then it gave me the pdf. SWEET. But, still dies after the first
mapping. If I call that same exact URL again, i get redirected to ...
/pdf/
.. with no filename. Odd. I added these directives....
RewriteLog "/var/log/httpd/rewrite_log"
RewriteLock "/var/lock/httpd/rewrite.lock"
RewriteLogLevel 2
.. but nothing ever is written to /var/log/httpd/rewrite_log, and
/var/lock/httpd/rewrite.lock never shows up. I put those directives in
the main server config, not the virtual host that I'm talking about.
My apache is running as user 'nobody' and the permissions on those
files/dirs are ..
/var/lock/:
drwx------ 2 nobody root 48 Aug 12 11:35 httpd
/var/lock/httpd/:
total 0
/var/log/:
drwxr-xr-x 3 nobody nogroup 168 Aug 12 11:37 httpd
/var/log/httpd/:
-rwx------ 1 nobody root 0 Aug 12 11:36 rewrite_log
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: [EMAIL PROTECTED]
" from the digest: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]