httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joshua Slive <jos...@slive.ca>
Subject Re: [users@httpd] JOB: rewrite expert needed
Date Thu, 27 Mar 2003 19:15:24 GMT

On Thu, 27 Mar 2003, Posts wrote:

> Hi,
>
> I need to configure httpd.conf (apache 1.3.27) to redirect all files
> not-found in any sub-directory to a php script in the root directory.
> Here's some examples.
>
> All rewrite to this file:
> {http-host}/getfile.php?file={requested-filename}
>
> http://mydomain.com/foobar.pdf <http://mydomain.com/foobar.pdf>  would
> rewrite to http://mydomain.com/getfile.php?file=foobar.pdf
> <http://mydomain.com/getfile.php?file=foobar.pdf>
>
> http://mydomain.com/somedir/foobar.pdf
> <http://mydomain.com/somedir/foobar.pdf>  would rewrite to
> http://mydomain.com/getfile.php?file=/somedir/foobar.pdf
> <http://mydomain.com/getfile.php?file=/somedir/foobar.pdf>

For this, I would use ErrorDocument and simply have the error document
php script look in the REDIRECT_REQUEST_URI (or whatever) for the
original URL.  No need to fool with mod_rewrite.

Joshua.

---------------------------------------------------------------------
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: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message