How to use php in an HTML file

Notice!

We do not recommend the method described below. This article is intended to solve a problem that some customers face after migrating to us.

Some developers have chosen to use .html file extensions for php scripts. The reasoning is unclear but this makes sites a little bit harder to transfer when the receiving server doesn't support that configuration. If your site uses .html files with embedded php code, please add this to your .htaccess file to ensure the pages load properly.

/home/user/public_html/.htaccess

AddType application/x-httpd-php5 .html .htm
Was this answer helpful? 0 Users Found This Useful (2 Votes)