|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Any ideas on how to make all files called from a certain directory, call a single file.
e.g all files in local directory call file called local? Thanks Barrie |
|
#2
|
|||
|
|||
|
<?
// following is a part of http://www.zend.com/zend/tut/photogallery.php, modified to my own needs // directory path $filepath = "../nasa"; // get unique server directory used for this user session $dir = dir($filepath); // loop through all server subdirectories for this user session while($entry=$dir->read()) { // if entry is system file (doesn't have picture files), go to next entry in // "while" loop if($entry == "." || $entry == "..") continue; // if there is an error, go to next entry in "while" loop $fp = fopen("$filepath/$entry","r"); if(!$fp) { print "Bad entry: $entry<br>"; continue; } fclose($fp); ?> <a href="../nasa/<? echo $entry ?>"><? echo $entry ?></a><br> <? } ?> Could this be usefull? Steffen |
|
#3
|
|||
|
|||
|
Thanks oskar...
Would it work with the following in the httpd.conf file? <location /local> ForceType application/x-httpd-php </location> |
|
#4
|
|||
|
|||
|
Well, I'm using win95 with my apache.
(Yeahh, I know, but I have to use my photoshop and flash to create websites) You will have to download the latest php-version: http://www.php.net Find the php-version that fits your platform. My apache conf-file looks like: ScriptAlias /php/ c:/apache/php/ AddType application/x-httpd-php .php Addhandler application/x-httpd-php .php Action application/x-httpd-php /php/php.exe Steffen |
|
#5
|
|||
|
|||
|
>> <location /local>
>> ForceType application/x-httpd-php >> </location> This tells Apache to force any request to your /local directory to be executed as PHP, it doesn't force them to execute /local/local at all. Why don't you use mod_rewrite? <Directory /server/path/to/local> RewriteEngine on RewriteRule ^(.*) local [T=application/x-httpd-php] </Directory> You can find more examples if you search RewriteRule under my username in Apache forum. Try this particular one -> http://forums.devshed.com/showthread.php?threadid=9203 |
|
#6
|
|||
|
|||
|
Thanks for the advice on mod_rewrite.....
Im trying to follow the article on http://www.phpbuilder.com/columns/tim20000526.php3 and have set up the a file called local as in the article. Any advice on which is the best redirection technique to use .htaccess httpd.conf or access.conf would be much appreciated. I have set up variables based upon the REQUEST_URI e.g. local/variable1/variable2 etc and the script uses the variables to decide which database, country, reference etc. I would like therefore to be able to 1) Redirect everything from /local to local.php 2) To pass variable1 variable2 etc into local.php Any help would be much appreciated, as my forte is with PHP and MYSQL, not perl. Thanks Barrie |
|
#7
|
|||
|
|||
|
>> Any advice on which is the best redirection technique to use
I have no plan to check out the article on phpbuilder. Your webserver is Apache, executing a PHP script (as a module or standalone CGI) will do another call to Apache. If you can do certain task at the very first call level - httpd.conf, that is the fastest and most reliable way of doing. Second level is .htaccess, then whatever script (php in your case). So why bother to put such load to Apache if you can do it at the very first level? Just put it in httpd.conf. If you want it to be more dynamic, do the 2nd level. >> 1) Redirect everything from /local to local.php >> 2) To pass variable1 variable2 etc into local.php Check this thread again -> http://forums.devshed.com/showthread.php?threadid=9203 Keep in mind, you are asking for external redirection, but you should go for internal redirection. |
|
#8
|
|||
|
|||
|
FreeBSD is correct, the best place to force the directive to parse /local as PHP is in httpd.conf.
If you root folder is /usr/local/apache/htdocs/ for domain http://www.domain1.com and you want http://www.domain1.com/local/whatever/might/be/here to run the local script just place the script called local in the /usr/local/apache/htdocs/ directory and place the ForceType directive in httpd.conf. If you don't have access to httpd.conf you can do it in .htaccess Note: you will need to parse the URL in the script "local" to get anything that is passed behind it as this will not be parsed automagically for you by PHP, even a generic query string. Besides, putting a query string behind the URL defeats the purpose of this manuever. |
|
#9
|
|||
|
|||
|
Rod or freebsd
Any chance of an ICQ number so that I could ask some quick questions? Thanks Barrie |
|
#10
|
|||
|
|||
|
If you want help with something you should post YOUR ICQ# rather than expect us to post ours in a public forum.
|
![]() |
| Viewing: Dev Shed Forums > System Administration > Apache Development > Forcing a file for all requests in a directory |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|