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

This situation can arise when you try to .htaccess override files processed by PHP. For example like this:

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

This construct can only be used when PHP is running in mod mode._php. PHP runs in a different mode on our servers — fastcgi, so handlers need to be redefined differently.

For PHP to additionally process files with the extension .html:

  1. V site settings in field «PHP files» add .html and save your changes.
  2. In file .htaccess remove all lines containing directives AddType and RemoveHandler
  3. Wait about 10-15 minutes and check for the problem.
Content