Forum Moderators: phranque

Message Too Old, No Replies

htaccess problem with action directive

         

xyloquark

12:34 am on Mar 17, 2006 (gmt 0)

10+ Year Member



I am running Apache 2.0 on a windows 2000 machine.
I want to run a php script when a static html page is
requested.

the base folder for the website is cyprax and there is a subfolder dynam.

I added the following to the .htaccess file in the cyprax folder:

addhandler dynam .html
addhandler dynam .htm
action dynam /dynam/apply_html_template.php

I thought this would execute the apply_html_template.php script in the dynam folder.

Doing a get for index.html from a browser results in a 404 message for the file
/dynam/apply_html_template.php/cyprax/index.html

How can I suppress the appending of /cyprax/index.html onto the script name?

Thanks.

jdMorgan

7:22 pm on Mar 17, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Just a guess: You could try something like:

Action dynam /dynam/apply_html_template.php?request_uri=

This would put the originally-requested URI into the query-string, where it would not affect the validity of the script's URL. I've never tried it, and won't be surprised if it works or not.

Another method is to simply parse html files for PHP code, or to use mod_rewrite to rewrite htm/hrml requests to the PHP file(s).


AddHandler Server-parsed .html .htm

-or-

RewriteEngine on
RewriteRule ^([^.]+)\.html?$ /apply_html_template.php [L]

Jim

xyloquark

10:37 pm on Mar 17, 2006 (gmt 0)

10+ Year Member



Adding a querystring worked.
Thanks for the idea.