Parsing HTML with PHP using .HTACCESS

by Chris Abraham on 07/12/2006 ·

I wanted PHP to parse not merely .php but also .html and .htm files on my blog. I added this as a separate line in my web root-level .htaccess file:

AddHandler php-script .php .php4 .php3 .html .htm .phtml

And it seems to work for me. Good luck and hopefully you won’t have to work so hard.


I had tried a load of them — none of these worked, which is why they’re commented out:

#AddType application/x-httpd-php .htm .html .php
#AddHandler application/x-httpd-php .php .html
#AddType x-httpd-php .html .htm

Thanks to Drak for the help!

Share on Tumblr

Facebook comments:

{ 1 comment… read it below or add one }

1 gavin 18/10/2010 at 19:06

Thank you sir!

I had tried a few other ways, and this is the only one that GoDaddy can use. You saved my bacon.

Reply

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

By submitting a comment here you grant this site a perpetual license to reproduce your words and name/web site in attribution.

Previous post:

Next post: