Using .htaccess to Parse HTML Files as PHP
I receive this question quite frequently by readers who want to know how to configure Apache to treat HTML files as if they were PHP. Parsing HTML files as PHP can be quite handy if you have a current HTML site that you’re moving over to PHP and you don’t want to have to change URLs. It’s also quite simple to do. It only takes one line in your .htaccess file.
AddType application/x-httpd-php .php .htmlAdding this line to your .htaccess file will add a new MIME type your Apache configuration. This tells Apache to recognize any of the provided file extensions as PHP. You can add as many extensions as you like. Just keep separating them with spaces.
Keep in mind, that these settings will override your server defaults.




























