How to control Apache URL to filename translation via PHP?

This is a discussion on How to control Apache URL to filename translation via PHP? within the PHP Language forums, part of the PHP Programming Forums category; Here's a problem I'm trying to solve: In the configuration page of our CMS there is place where ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 08-07-2004
Chung Leong
 
Posts: n/a
Default How to control Apache URL to filename translation via PHP?

Here's a problem I'm trying to solve:

In the configuration page of our CMS there is place where the administrator
would specify the directory where uploaded audio files will be stored. The
page currently does not work as fully as I would like. After a change the
audio files are not web-accessible until httpd.conf is updated to map URLs
to the new folder (and an Apache restart).

In my httpd.conf there's a line that looks like the following:

RewriteRule ^/audio/(.*) C:/Audio/$1

So it seems if I can somehow make the "C:/Audio" part a variable that can be
modified by PHP, my problem would be solved.

Any idea?


P.S. Don't suggest using readfile(), fpassthru(), etc.


Reply With Quote
  #2 (permalink)  
Old 08-10-2004
Brion Vibber
 
Posts: n/a
Default Re: How to control Apache URL to filename translation via PHP?

Chung Leong wrote:
> In my httpd.conf there's a line that looks like the following:
>
> RewriteRule ^/audio/(.*) C:/Audio/$1
>
> So it seems if I can somehow make the "C:/Audio" part a variable that can be
> modified by PHP, my problem would be solved.


You can configure Apache to use an external program as a filter for
rewrite rules; a PHP command-line script could probably do the job.

See:
http://httpd.apache.org/docs/mod/mod...tml#RewriteMap

-- brion vibber (brion @ pobox.com)
Reply With Quote
  #3 (permalink)  
Old 08-11-2004
Chung Leong
 
Posts: n/a
Default Re: How to control Apache URL to filename translation via PHP?


"Brion Vibber" <brion@pobox.com> wrote in message
news:2nqgd7F3kugbU1@uni-berlin.de...
> Chung Leong wrote:
> > In my httpd.conf there's a line that looks like the following:
> >
> > RewriteRule ^/audio/(.*) C:/Audio/$1
> >
> > So it seems if I can somehow make the "C:/Audio" part a variable that

can be
> > modified by PHP, my problem would be solved.

>
> You can configure Apache to use an external program as a filter for
> rewrite rules; a PHP command-line script could probably do the job.
>
> See:
> http://httpd.apache.org/docs/mod/mod...tml#RewriteMap
>
> -- brion vibber (brion @ pobox.com)


A static RewriteMap seems to work well enough. Thanks for the suggestion!


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 08:58 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0