SitePoint Sponsor |
|
User Tag List
Results 1 to 4 of 4
-
Sep 25, 2002, 13:05 #1
- Join Date
- Feb 2000
- Location
- Grand Rapids, MI
- Posts
- 61
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Apache -- execute on a file type?
I don't know what this is called, but I believe it can be done, and appreciate any help.
I want to configure apache to execute a script on a file anytime that filetype is accessed.
For example, I have myfile.tampa. When someone hits that file (www.myserver.com/myfile.tampa/) I want a script to run on the file automatically (in this case, a php script).. and the script will output the results to the browser.
What I'm trying to do is avoid putting the script in every users home directory, or give the indication that it's even running a script. When a visitor hits myserver.com/myfile.tampa I want them to see the results.
I have an apache book here, again, my problem is I don't know what this is called... if anyone can point me in the right direction, I would greatly appreciate it.
Thanks!My new position : Target for Middle Management Hostility.
-
Sep 29, 2002, 08:44 #2
- Join Date
- Jul 2001
- Location
- Italy
- Posts
- 4,514
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Hi there,
I see that after 4 days no answers...so I try one suggestion but I'm not sure it's what you wanted...
Try to use the ForceType directive and try to force every request for myfile.tampa as a php file:
.htaccess
Code:<Files myfile.tampa> ForceType application/x-httpd-php </Files>
PHP Code:<?php
print 'This file can be parsed as a php file<br>';
print 'even if it has not a php extension!';
?>
pippo
-
Sep 30, 2002, 06:19 #3
- Join Date
- Jun 2000
- Location
- Sydney, Australia
- Posts
- 3,798
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I think mod_rewrite's tools are what you are after. check out:
http://httpd.apache.org/docs/mod/mod_rewrite.html
Eg of a rewrite rule you could throw into httpd.conf
Code:RewriteCond %{REQUEST_URI} \.tampa$ RewriteRule ^.*$ /path/to/your/script
-
Oct 1, 2002, 18:49 #4
- Join Date
- Feb 2000
- Location
- Grand Rapids, MI
- Posts
- 61
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I think the mod_rewrite is what I'm looking for... I'll check into it.
Thanks!My new position : Target for Middle Management Hostility.
Bookmarks