Wednesday, October 17, 2007

How to insert PHP code in .html files

Create a blank file and call it .htaccess, you will need to upload this file on your server in the directory where you want to have .html pages containing php code or you can also place the .htaccess file in your site root, the settings inside it will apply to all its sub directories.

You need to type these lines inside your .htaccess file:



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

Note: Some servers might require that you use this line instead (it depends on server configuration):




  1. AddHandler x-httpd-php .html .htm .cgi .php

No comments: