• You thought the first one was fun?
    Temple Run
  • With just a swipe of your finger
    Find a
  • The Everest App
    is shutting down

Convert HTML to PHP


How to convert a HTML website to PHP without losing your file extensions


When I first decided to start using Visitor Stats 2, some of my websites were still in HTML, which meantI would have to change all the file extensions to PHP. I didn't want to do this as I was concerned about websites linking to my existing HTML pages, as well as the search engines and peoples bookmarks.

I discovered a easy, fool-proof way to convert a website from HTML to PHP, without losing links, search engine positions changing your filenames (or extensions).

Why would you want to change from HTML to PHP? Well, there could be many reasons, you might want to add a php shopping cart to your website, or add a website tracking program.

Whatever it is you want to do, to use PHP's wonderful features you will need to ensure you have PHP enabled first.


Converting your HTML pages to PHP


If you have read this far lets assume you have a real need to use PHP, but are afraid to lose links from other website's to your pages, or that Google might not index your new pages properly.

There is an easier way than re-naming all of your '.htm' page to '.php'... but still using PHP.

I only wish I had this information earlier as I spent hours renaming all of the pages on some of my websites to '.php' in order to use my Visitor Stats 2 tracking program.

Converting your HTML files to PHP

First, you can simply open up the page you want to use PHP, and run a little test.

Lets open a file called 'index.htm' or something similar. At the very top of the page, before even the <html> tag add this code:

(you can simply cut and past this code into your page using Dreamweaver or Notepad)

Now we have a page ready to test for PHP... lets add the PHP functionality for your HTML pages.


Adding PHP functionality to HTML files

Download this file and upload it to the root directory of your website, then rename it to '.htaccess'

This tells your website server to look for any .htm or .html pages and treat them as if they where a .php page... all without even renaming your pages!

You don't even have to update your links, all of your .html or .html pages should be able to run PHP now.


Testing for PHP

Now upload the 'index.htm' page that you added the PHP code to (see above) to your website, and open up your web browser (such as Internet Explorer or Opera).

Type in the name of the uploaded index.htm page, for example:www.mydomain.com/index.htm

If PHP is running properly, you should see the message "Testing that PHP is running ok... success!".

NOTE: some webservers do not support this functionality.


If you see the message, well done! You now have PHP installed and running on your HTML pages!

Yari McGauley
Creator of Visitor Stats 2

Latest News

Tinder also goes on to claim that they are not the only product that offers different pricing for different age groups, and while that is most certainly true the example they cite is Spotify and their student pricing. They also claim that they are trying to make their product available to younger people cheaper as they are more budget constrained.
Read More