Configure HTML Files to be parsed as PHP file in Apache

This has been one of the most frequently asked questions that php developers ask me, about how to configure Apache to serve files with .html extenstion as php files and let php to parse those files before they are sent to the client.

Solution

The solution is very simple, all you have to do is to add a “AddType” directive either in your .htaccess or httpd.conf of your Apache

AddType application/x-httpd-php .html

Save and restart your apache(if you did the changes in httpd.conf ) and your are done !

Now you will eb able to parse .html files as php files.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>