How to Make HTML Pages Recognize PHP
Related Podcast Link: Listen to Episode 123!
I love using PHP code and scripts. They can come in handy a lot of different ways in a lot of different places. In most cases people learn that if you want to run PHP scripts or execute PHP code your pages need to be in the .php format. What if all of your pages are already .html, .htm, or dot something else?
You are not left in the dark - I promise.
For an example, lets say Chuck has a large web site that is all done with .html pages. It was setup a long time ago, he didn’t know about any of the new web technologies out there, and he was happy with his simple static site. Now his friend Billy tells him he could add a few more dynamic things if he used some PHP code here and there.
The problem is Chuck doesn’t want to turn all his .html pages to .php pages.
What Chuck needs to do is add a few simple lines to his .htaccess file:
RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html
After that, all of Chuck’s .html pages will be pushed through the server as .php pages. So this way he can keep his .html extension but use PHP. Now I know that isn’t the most technical way of putting things, but it is a way that we can all understand. The important thing is now Chuck can now execute PHP scripts in .html files.







From time to time stupid things happen to good people. Now if that alone isn’t a good enough reason to backup your web site - I don’t know what is. I learned a very valuable lesson this past weekend when upgrading WordPress on all of my projects that use it. Make sure your current theme folder does not match one of the ones that they install by default. If you do - the layout will forever be lost, and you will waste a Saturday designing a new layout.
Oh do I ever have a show lined up for you. It’s been a while since I’ve been this excited and I promise - no I guarantee - after you listen you’ll have to agree. From domain slammers to creating your own search engine we have a little bit of something for everybody right here on the Web Hosting Show.