I've been researching and testing various solutions for hours on end, trying to find the right htaccess directive to prompt my server to parse html as php. I have read numerous threads on this forum, such as the ones here and here, along with many other resources, and I still haven't been able to find the right directive.
My hosting provider is XO Communcations, and their "support" is utterly horrendous-- they do not even technically offer support for these sorts of questions beyond reviewing the paltry contents of their online "knowledge base"; I plan to switch providers soon, but I'm hoping to find a workable solution in the meantime. I believe PHP is running as CGI on their (Apache) server, which seems to be extremely sensitive with respect to the sorts of directives it will accept. The following directives constitute what I have tried thus far, with the corresponding result below:
(1) AddType php .html .htm
(2)AddType application/x-httpd-php5 .html .htm
**neither parses the PHP within the HTML file
(1) AddType application/x-httpd-php5 .html .htm
(2) AddHandler x-httpd-php5-cgi .html
**both prompt to download file
(1) AddHandler php5-cgi .html .htm
(2) Options +ExecCGI
AddType application/x-httpd-php .php .html
AddHandler x-httpd-php5 .php .html
(3) AddHandler application/x-httpd-php .html .htm
**all prompt configuration errors
RewriteRule ^(\w+)\.html$ $1.php [NC]
**does not parse PHP in HTML
The only semi-workable solution I have found is the following directive
RewriteRule ^(.*)\.html$ $1.php [L]
, however that would require me to rename every single html file on my server as php, which is not feasible. My goal is to integrate php into my site while retaining the existing link structure.
I'm hoping based on the clues I've provided someone with far more knowledge/experience in this arena than I may have some insight....