I have the following line in .htaccess
AddType application/x-httpd-php .html .htm
And it used to work for years to treat html pages as php, however recently I noticed it is not working anymore, except only in the homepage (example.com
), and not even at the same page (example.com/index.html
)
I tried now to add the following to /etc/apache2/mods-enabled/php5.6.conf
and restarted apache, but still it didn't work. Also tried other suggestions here, but still no luck.
<FilesMatch ".+\.html$">
SetHandler application/x-httpd-php
</FilesMatch>
Any idea what could have happened? Or how to fix that?
Best Answer
Find out your handler by creating a PHP file with following contents
When opened from browser, it will return the handler name for php. Then replace your current htaccess code with correct handler. For example, if your output is
application/x-httpd-php5
, then your htaccess will look like this:Reference: https://stackoverflow.com/a/49375772/2703813