Process .html as PHP
Posted in Apache, PHP | By LGR | On February 7th, 2007
Hanging out at web master forums I am amazed at the number of times I come across posts asking how to process .html files as PHP. Often the question is being asked because they want to start using php to include parts of their template instead of creating static .html files. Well here is a little piece of code that has saved me countless hours, especially when moving a static .html files site to a dynamic PHP site.
To setup a Linux server running Apache web server to process .html (.htm) files as PHP. create an .htaccess file in the root folder of your website and add these lines to the .htaccess file:
AddType application/x-httpd-php .htm
AddType application/x-httpd-php .html
As long as your server has been told to process .htaccess files this will tell the Apache web server to process all .htm and .html files now as php files. This now allows you to include other php files, use variables and all kinds of PHP programming on your old static .html files.
Similar Posts:
- Disable Indexes using .htaccess
- Blogger Label List for FTP Published Blogs
- Webmaster Time Savers – Using Includes
- .html Versus .php for SEO
- Use Redirections to Help Users and Search Engines
- Custom 404 Page using .htaccess
- Webmaster Time Savers – External Javascript
- Include, Include_once, Require, Require_once
- WWW or Not: That is the Question?
- Tell the Robots Where Not to Go


[...] if you have setup your server to process .html files as php then your server will process PHP includes that you have in your Blogger template file. Find the [...]
[...] Process .html as PHP [...]