Parsing PHP on .html pages
There are 2 ways of getting your .html pages to parse PHP, this is via:
- .htaccess
- httpd.conf
In both methods above, you need to make sure that your server supports PHP.
Which method to choose?
For most webmasters who uses shared hosting and do not have access to their server’s configuration files, you would use method one, via .htaccess. If you have access to your server’s configuration files, that is, you have a dedicated server and can access httpd.conf, then use method two, via httpd.conf.
- Create a .htaccess file or open your existing .htaccess file in your root directory.
- Add the following line to your .htaccess file:
AddType application/x-httpd-php .html - Save your .htaccess file and upload to the root directory of your web site.
Your .html page will now parse PHP.
2. Via httpd.conf
- For Linux servers using Apache, find a file called httpd.conf. This file should be in the folder called, “conf” in the Apache program files. It may be on the server as:
/etc/httpd/conf/httpd.conf - In httpd.conf, find the line that looks like this:
AddType application/x-httpd-php .php - Add the following line below:
AddType application/x-httpd-php .htmlOr alter the
AddType application/x-httpd-php .phpto:AddType application/x-httpd-php .php .html - After making these changes, restart your web server. For unix based servers, using this command:
service httpd restart
Your .html pages will now parse PHP.


October 31st, 2005 at 9:04 am
I like this site very much!
April 26th, 2008 at 11:50 pm
This is very interesting but the .htaccess AddType etc kills off the parsing of html on my sites and the additions to the httpd.conf make no discernable difference.
These sites are on unix servers and my ISP is apparently not up to speed on these tweaks.
Excellent site.
Please keep up the good work.