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 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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. |
|
|||
|
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) |
|
|||
|
"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! |