user2053904
user2053904

Reputation:

enable again apache2 to parse html file as php7 using .htaccess

I have an Ubuntu 16.04 64bit desktop and php7 enabled by default.
Some client of mine like to embedded php script into html page.

some time ago I write a .htaccess file like this:

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

Now this syntax is no more working.
I have try a lot of same syntax but nothing work.

I had to change /etc/apache2/mods-enabled/php7.0.conf adding

<FilesMatch ".+\.html?$">
    SetHandler application/x-httpd-php
</FilesMatch>

but this is not a good solution: all html page are enabled to be parsed as php file!

Someone have right new configuration?

P.S. in site's conf file I have AllowOverride All enable on site directory

Upvotes: 1

Views: 1880

Answers (1)

mega6382
mega6382

Reputation: 9396

You can try the following solution in your .htaccess:

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

Worked for me with PHP7.

Upvotes: 1

Related Questions