Helping ordinary people create extraordinary websites!
   

How to convert my HTML website to PHP?

Friday, 4th December 2009
by Rico

I have a website created with .html extensions that I built years ago. The site has numerous pages which makes updating it a real chore. I would like to make the site easier to manage and also be able to add some cool things to it with PHP but I would lose all my incoming links and even internal links as seen by Google if i switch the pages to .php. Is there a way for me to accomplish this quickly and easily so that I may have PHP functionality without having to change my .html file extensions to .php?





Erin
You can configure your server to parse .html files for PHP probably, but you don't have to lose your incoming links; you can use 301(permanent) redirects to maintain references from the old URLs to the new ones.

Example - this in your .htaccess file:

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)\.html /$1.php [NC,R=301]

Then you could use a renamer to batch all the files and swap the extension out, while maintaining the file names and directory structure.

Monday, 14th December 2009
Votes:
8
8

More PHP Help:
» How to read the content from another webpage and store in MySQL?
» How to select and display a set of images from a folder using PHP?
» Can I use PHP global variables inside Javascript?
» How to do calculations with CodeCharge Studio?
» How to create nested foreach loops in PHP?
» PHP array to string?
» How do I make a PHP5/MySQL login system with admin features?
» PHP file to script