I was going through a situation where – on linux shared hosting server I have to use parse HTML web pages as PHP. It was pretty much new for me as I had worked on CMSs like WordPress & Drupal.
Initially, task was to redesign a huge site to new look. Website had more than 100 pages but on all pages, most of content like sidebar, footer was duplicated. Means if you want to change any menu item then one has to replicate changes on all 100 pages that site have. That was impractical and tedious job to do. I suggested continuing use of HTML & including common part of web pages with use of PHP includes. I did same on demo local server but when I uploaded on hosting server purchased from Godaddy, PHP scripts didn’t worked.
After lot of search on web I found below code to use with htaccess file.
Options +ExecCGI AddType application/x-httpd-php .php .html AddHandler x-httpd-php5 .php .html
It worked for me & I was happy.
After few months I did same procedure for another site. But surprisingly it didn’t work. Reason was – recently Godaddy went through some changes to shared hosting control panel. They gave it new look of cpanel (I don’t so it matter). But still due to configuration changes on Godaddy server setting provided by htaccess did not work.
Here started another tense time for me to look & try many options & combinations in htaccess file but nothing was working. Then after following with Godaddy for three days & knocking them on Twitter they provided me below code
AddHandler fcgid-script .html FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .html
And it worked on new hosting space instantly.
If you are doing similar try above code in htaccess. Hope it will be useful to get over tedious try and error scenario.