I am writing some PHP code in my .htm and .html pages but it's not executing the code. I must strictly not have to change the page extension.
I have added this handler to the .htaccess
page
AddHandler application/x-httpd-php74 .php .htm
AddHandler application/x-httpd-php74 .php .html
My server PHP version is PHP 7.4
What I am missing, how to use PHP code in .htm and .htm pages?
I am doing this on siteguard hosting
so if any server configuration I may missing?
CodePudding user response:
Add the following to your .htaccess
AddType application/x-httpd-php .html
CodePudding user response:
PHP able to work with CLI or .php script files otherwise doesn't work. Because before from run PHP need compile.
You can use .htaccess abilities instead write code in HTML files. Just like the following code sample.
RewriteRule ^view\.php?mode=prod&id=([0-9] ) /products/$1.html