Replace .php extension to .htm/.html extension

Do you wish to execute your php script using .htm / .html file extension? Then this code will help you. By simply using .htacces file, your php script will execute using .htm and .html file extension. Please follow the steps below. 1. Create a file index.php, and copy the below script.
  1. <html>
  2. <head>
  3. <title>Change .php extension to .htm/.html</title>
  4. </head>
  5. <body>
  6. <?php echo "<h1>It works</h1>"; ?>
  7. </body>
  8. </html>
2. Create a file .htaccess, and copy the below script. AddType application/x-httpd-php .html .htm Note: It should be .htaccess, don't need to add other keyword. 3. Then run the script in your viewer which your index.html Thank you for reading this tutorial, hope this will help you in your web development.

Comments

nice one!

Add new comment