0

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....

Community
  • 1
  • 1
nickpish
  • 839
  • 4
  • 24
  • 43
  • A longshot, but did you also try to use filesmatch? ` SetHandler application/x-httpd-php5 ` (Though the stuff you tried already should work on any decently configured server, I guess) – leo Apr 17 '14 at 08:50
  • Thanks for the suggestion, Leo, but that doesn't seem to work either (the PHP doesn't get parsed in the HTML.) I'm not sure what else there is to try... – nickpish Apr 17 '14 at 09:00
  • Switching providers early seems like a good option... – leo Apr 17 '14 at 10:34
  • Yes, Leo, you are correct. In the interest of saving anybody else similar hours of frustration, I've learned from XO support that they have a "customized" Solaris implementation that does not allow many standard directives such as the one I was seeking above. Bye bye XO! – nickpish Apr 17 '14 at 23:06

0 Answers0