I have added php code in html file and run this file as .html extension. For this technique i have added below code in .htaccess file.
AddType application/x-httpd-php .html .htm
This whole folder is sub directory of wordpress project folder.When i am run this file in server, pop-up comes and my code file is opens in popup and it will give option to download. where i can see the whole code. What should i do to prevent to pop up box for download and run php code in html file and open as .html extension.
Can anyone help me what should i do?
Your php block of codes must be inside the tag
<?php
// Your php code might not work here
?>
<!DOCTYPE html>
<html>
<?php
// Your php code will work here
?>
<head>
<title>Title</title>
</head>
<body>
<?php
// Your php code will also work here
?>
</body>
</html>
</div>
In order to use php in .html files, you must associate them with your PHP processor in your HTTP server's config file. In Apache, that looks like this:
AddHandler application/x-httpd-php .html