Parsing .HTML and .HTM Files as PHP (with htaccess)

Posted: 2015-10-19 22:13:26

To have Apache run .html and .htm files through PHP, add this configuration into the website’s .htaccess file.

AddType text/html .htm .html

# For mod_php5 and mod_php7
<IfModule !fcgid_module>
	AddHandler application/x-httpd-php .htm .html

# For mod_fcgid
<IfModule fcgid_module>
	AddHandler fcgid-script .htm .html
	FcgidWrapper "C:/WampDeveloper/Components/Php/php-cgi.exe" .htm virtual
	FcgidWrapper "C:/WampDeveloper/Components/Php/php-cgi.exe" .html virtual

This will work for both mod_php and mod_fcgid.

Use the correct path in the FCGIWrapper .../php-cgi.exe lines.