HostGator using .htaccess to process .htm files in PHP

I recently took over a site that was developed in PHP, but the files in the web root were all named with a .htm extension. You can read my quick post on running .htm or .html files through PHP in Apache to see what I did to get it running. Works like a champ on my local box.

I experienced a problem, however, when I uploaded the site to my HostGator account. When I did, I was either prompted to download the file, or the PHP code was ignored within the .htm files.

So I began trying various combinations in my .htaccess file, as well as within my control panel to get it to work.

Finally, I broke down and emailed HostGator tech support, explaining my problem. Within 10 minutes I had a reply back with a fix. Here's the recommended usage if you use HostGator:

AddHandler application/x-httpd-php5 .php .htm .html

When that was added, all of the pages began working like a champ!

I hope this can help another HostGator user down the road.


Back to the Top