ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel
  • »
  • Technology»
  • Computers & Software»
  • Computer Science & Programming»
  • Programming Languages

Convert HTML WebSite to PHP

Updated on November 13, 2010

Text Editor-Gedit

My trusty text editor Gedit.
My trusty text editor Gedit.

From Static to Dynamic in a Few Short Minutes

In the modern Internet, dynamic websites are key to a successful business venture. the old static HTML just can't compare to what one needs. I had this old static site as my home page. I needed to pace some server-side srcipts in there to strut my skills. To do this the files needed to be converted from HTML (with a .html file extension) to PHP files. I did this with Gedit, a Linux text editor and my trusty old Linux shell. There are many ways to do it. There are many text editors for Linux, Windows, and Mac. A simple search on Google or Bing will give you a free one. 

First, I opened a shell and went to the directory on my own machine where the files are stored and typed the following:

john@john-laptop:~$ cd Documents/WebDesignStuff

john@john-laptop:~/Documents/WebDesignStuff$ cd Dark_Metal

john@john-laptop:~/Documents/WebDesignStuff/Dark_Metal$ ls

about.html       contact.html   index.html~     newsfeed.php~  webdesign.html

about.html~      contact.html~  linux.html      scripts.html   webdesign.html~

affilate.html    images.html    linux.html~     scripts.html~

affilate.html~   images.html~   newsfeed.html   servo.swf

affiliate.html   img            newsfeed.html~  style.css

affiliate.html~  index.html     newsfeed.php    style.css~

john@john-laptop:~/Documents/WebDesignStuff/Dark_Metal$ mkdir PHP

john@john-laptop:~/Documents/WebDesignStuff/Dark_Metal$ cp about.html PHP/about.php

john@john-laptop:~/Documents/WebDesignStuff/Dark_Metal$ cp affiliate.html PHP/affiliate.php

john@john-laptop:~/Documents/WebDesignStuff/Dark_Metal$ cp contact.html PHP/contact.php

john@john-laptop:~/Documents/WebDesignStuff/Dark_Metal$ cp images.html PHP/images.php

(etc., etc., The terminal output is too long and just too damn boring to print it all!)
After the html files had been copied into PHP in a different directory, I then opened good old Gedit text editor. I believe you can do the same thing with Windows Notepad. I opened all of the files in separate tabs, and did a "search and replace." I inserted the name of the old files ending with .html and replaced them with .php. I did this for every file name. It was that simple. I ran this over every one of the open tabs. This is because my internal navigation links were to the old HTML files instead of the PHP. I then opened my trusty FTP client Filezilla (works on Windows, Linux and Mac.) and opened "site manager." I opened that account, logged in, and deleted all of the HTML files in the site. Then I uploaded all of the PHP files. Bingo! It took the really slow server several minutes to load the new files, but it's working now. 


    0 of 8192 characters used
    Post Comment

    No comments yet.