473,396 Members | 1,838 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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.
Jul 17 '05 #1
2 1909
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)
Jul 17 '05 #2

"Brion Vibber" <br***@pobox.com> wrote in message
news:2n************@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!
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Joshua | last post by:
Is there a way to set up Apache to invoke a PHP equest when a file (a image for example) is downloaded? Say, then, that http://www.foo.com/downloads/app1.zip is downloaded, Id like to have...
0
by: Phil Powell | last post by:
if ($this->isSuccessful && !$hasMogrified) { // SMACK IT ALL TOGETHER @imagecopyresampled($newImage, $image, $config, $config, 0, 0, $config, $config, $origWidth, $origHeight); // SAVE TO FILE...
2
by: Jim Cobban | last post by:
I must be missing something. I am using org.apache.xml.serialize.XMLSerializer to save a DOM but I am not getting non-basic characters converted to UTF-8. I create Text nodes in the DOM by,...
3
by: Jim Cobban | last post by:
I must be missing something. I am using org.apache.xml.serialize.XMLSerializer to save a DOM but I am not getting non-basic characters converted to UTF-8. I create Text nodes in the DOM by,...
9
by: Charts | last post by:
I use VS2005 to build a asp.net 2.0 project. I want to be able to click a button on the page and have a dialog window appear where I can navigate the folders to get hold of a file path to load...
3
by: madunix | last post by:
My Server is suffering bad lag (High Utlization) I am running on that server Oracle10g with apache_1.3.35/ php-4.4.2 Web visitors retrieve data from the web by php calls through oci cobnnection...
19
by: Neil Cerutti | last post by:
Where can I find documentation of what Python accepts as the filename argument to the builtin function file? As an example, I'm aware (through osmosis?) that I can use '/' as a directory...
3
by: froditus | last post by:
Hello everyone, is it possible to list files from directory other than in apache web directory? my web folder is placed on c:/ and i put my files in windows directory "d:/files/images/". I...
2
by: Extremest | last post by:
I have a picture site. I save the original and a thumbnail of every picture. Now if they click on a thumbnail then they go to the viewer page where they then see an intermediate picture. I have...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.