Programming Tips

Search Engine

SEO Chat

Affiliate Blog

Using PHP includes in html files

This one really caught me by surprise. One day my site (  is working fine, the next day I'm getting the following error when I try to open an html page:


You don't have permission to access /index.html on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

Apache Server at Port 80

I'm using Economy Linux Hosting for this domain, with PHP5. When I contact their helpdesk, after I pushed back really hard on the  "clear your cache", "try a different browser", and "disable plugins" suggestions, someone finally decided that the solution was to remove my .htaccess file and that they don't support "custom coding".

Here are the contents of that .htaccess file:

AddHandler x-httpd-php5 .html .htm .cgi .php

Of course, this line is needed in order to use php in your html files, such as in the following command:
<?php include("./menu.php"); ?>

Since I have multiple GoDaddy hosted sites, I was able to determine that Hosting Configuration 2.1 or earlier doesn't have the problem, and that it only manifests on a site with Hosting Configuration 2.2.  Hmmm, those numbers look like Apache versions.  While I never got anyone to admit it, it appears as though GoDaddy updated their Apache web server to version 2.2, which needs new commands in the .htaccess file in order to map PHP parsing to html files.  They were nice enough to point out that the "Options +ExecCGI" line is now required in .htaccess file in order to map php parsing to html files.  In summary, your .htaccess file should look like this:

AddHandler x-httpd-php5 .html .htm .cgi .php
"Options +ExecCGI"



Search Engine Submission

Add Me!

Free Search Engine Submission

Email Marketing Constant Contact.
FREE 60-Day Trial.