Richard Webster Richard Webster - 4 months ago 18
HTML Question

GoDaddy host html parse php won't work

Hey guys I think I've tried everything I can find myself so hopefully someone here can help me.

I'm using php include for a header and footer, but for now just testing pulling a little code through. When my test page is a php file, with the code to include another php file, the inclusion works perfectly. So with this I know my hosting has working php. However when I change the extension of the test page to html nothing comes through.

I have tried adding various lines to my .htaccess file (which is currently blank) and none have worked. They either have no effect, or instead of viewing my webpage Chrome downloads it instead, both php and html files. Like I said my .htaccess is currently blank.

Various lines of code I have tried adding to my .htaccess file (which by the way sits in my public_html folder). Spaces separate combinations used.

Options +ExecCGI
AddType application/x-httpd-php .php .htm .html
AddHandler x-httpd-php5 .php .htm .html

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

AddType application/x-httpd-php .html .htm

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

AddHandler x-httpd-php .html .htm

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

php.ini file:

allow_url_fopen = 1
allow_url_include = 1
short_open_tag = 0

Test page:


<h1>Welcome to my home page!</h1>
<p>Some text.</p>
<p>Some more text.</p>
<?php include 'footernew.php';?>


include file (footernew.php):

<p>This is a test page using php include</p>

As I said as a php file it works perfectly, no issues. I've tested with more advanced code also for my main page. HTML just won't parse php and I think it's something with the way GoDaddy do their servers. Tech support couldn't help with this particular issue either.

For reference I'm using linux hosting with PHP 5.4, and my html tag is HTML5 (!DOCTYPE html).


I had the same problem, Godaddy Linux hosting PHP5.5. After 3 tech support calls with no solution I ended up using the code below in the .htaccess file in the public_html folder so when a visitor asks for a .htm file the server will serve a .php file of the same name and pretend it is the requested .htm file. Godaddy is the worst of the worst but in my case this work around saved me, hope it works for you situation.

RewriteEngine on
RewriteBase /
RewriteRule ^(.*)\.htm$ $1.php [nc]