SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    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.

  2. #2
    FreeBSD The Power to Serve silver trophy pippo's Avatar
    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>
    myfile.tampa
    PHP Code:
    <?php
    print 'This file can be parsed as a php file<br>';
    print 
    'even if it has not a php extension!';
    ?>


    pippo
    Mr Andrea
    Former Hosting Team Advisor
    Former Advisor of '03

  3. #3
    ********* Callithumpian silver trophy freakysid's Avatar
    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

  4. #4
    SitePoint Enthusiast
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •