Making your PHP code work within files with extension .html

August 1st, 2010

By default your php code will only work if the file is named .php but if your files have extension .html or .htm and you would like them to be able execute php code as well, you would need to make a small change to .htaccess

Just add the lines below in .htaccess file and you would be able to execute php in html files

RewriteEngine on
AddHandler application/x-httpd-php5 .html .htm

Related Articles:
1. Redirecting your non www domain.com to www.domain.com using .htaccess

Leave A Comment