2.4.3.15. PHP code in HTML files does not work, or instead of opening site, download.php file is downloaded.

The problem may occur when you attempt to override files that should be processed by PHP in the .htaccess file as follows:

RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html

This construction can only be used when PHP is running in mod_php mode. On our servers, PHP operates in a different — fastcgi, so handlers need to be overridden differently.

To have PHP additionally process files with the .html extension:

  1. Open the "Site settings" section.
  2. In the "PHP files" field, add .html and save the changes.
  3. Edit the .htaccess file and remove all lines with the directives AddType and RemoveHandler.
  4. Wait approximately 10-15 minutes and check for the issue.
Content

    (1)