Parse HTML As PHP Using HTACCESS File On Godaddy

Parse HTML As PHP Using HTACCESS File On Godaddy

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.

32 Comments

  • You are a life saver man I want you and all visitors to read this answer from the godaddy team. According to them it was a “script” issue. I was like REALLY? specially when this happend one month ealy but accidentally the .htaccess got deleted. Just checkthe lame excuse not to find a solution

    ______________________________________

    Thank you for contacting Professional Hosting Services regarding the issue you’re having executing PHP scripts in .html files through your rehobothbeachfever.com website.

    We have reviewed your account and could not find any issues with your hosting plan. The type of error you are experiencing is most likely caused by coding or scripting. Because we do not provide coding support, we are unable to determine what specifically in your code may be causing the error. However, the following may be of some assistance in diagnosing the problem:

    Upon testing your account I’ve found the issue to be caused by the configuration of your .htaccess file. With this file enabled no PHP content is parsing, but when we disable it we are able to run PHP scripts without any issue.

    You may wish to review your code to determine if there are any issues, because it appears that is the most likely cause of the error. You may also wish to enable detailed error messages as a temporary diagnostic measure. The procedure for this will vary, depending on the scripting language being used. We also recommend consulting both the vendor’s online documentation, as well as the large number of online forums dedicated to coding and scripting.

    If you determine there is no issue with the code itself and believe the issue is server related, please reply with specific evidence of this and we will investigate the matter further.

    Please let us know if we can assist you in any other way.

    Sincerely,
    Dave E
    Professional Hosting Services

    As I value your feedback regarding my service, please take a moment to complete the short survey linked at the bottom of this email.

  • all The old methods Which are all around the net don’t work, Probably due to Godaddy’s recent changes, As for May 2014 The second code provided by Albert, is the only way to do it.

    tnx man

  • Thanks. I found your .htaccess solution after about an hour of searching after I moved from another host to GoDaddy. I should point out that for me after the change is uploaded wait about 20-30 seconds before the refresh.

  • Hi Sagar – thanks for posting this, as worked perfectly for me. I spoke to Go Daddy tech support earlier and they said that I should just need the ‘standard’ .htaccess changes that I’d find on Google!

  • Thank you! This was a hugely frustrating problem as my old htaccess worked fine on godaddy ‘economy’ plan, but when the site was switched to the shared ‘deluxe’ plan with addon domains it stopped working, I could not figure out why until seeing this page, this was a huge help!

  • Many thanks for sharing. I spent about 3 hours looking for a solution and trial by error testing before I determined godaddy was doing something different than everyone else. It was only then I found your solution.

  • Thank you so much!!! Yesterday, I had to move a website from one GoDaddy hosting account to another. I then discovered the parsing of html files wasn’t working on the new account. The new account had the new cPanel look (“Paper Lantern” interface) you mentioned.

    Since I knew the exact problem. I called GoDaddy support but they didn’t have a clue on this one. So I did a bit of googling and fortunately, found this page. Once I updated the .htaccess file with the code you listed at the bottom of your article, parsing worked just fine!

  • My old htaccess file was working fine in other server but after shifting to godaddy it was a hugely frustrating problem. I’ve been searching the web for hours trying to figure out why my .htaccess file wasn’t working. You saved my life with this great solution, Thank You.

  • Thank you so much!

    I tried a number of other solutions but none of them seem to work – until I stumbled upon your piece of code!


Leave a Reply

Your email address will not be published. Required fields are marked *

Show Buttons
Hide Buttons
%d bloggers like this: