Home » » Converting HTML Pages to Run PHP

Converting HTML Pages to Run PHP

Written By mangido on Selasa, 11 Oktober 2011 | 09.26

This issue frequently arises when site owners want to convert legacy .htm or .html pages to run PHP, but they do not want to change the file name extensions due to the potential loss of rank positions when the URLs are changed. It is easy to convert HTML pages to run PHP if you know how and you can change those static pages to run dynamic PHP code.

First, the site needs to be on a Linux or Unix server running the Apache web server. This will not work on a Microsoft server. You also need to use a hosting company that allows server overrides using the .htaccess file. Almost all except the extreme low-end hosting companies allow server overrides, but that question needs to be asked before you commit to hosting services.

The .htaccess file can be found in the root directory. It is a hidden file, so you may have to configure the FTP utility to display the file. if the file exists, download it to your PC so that you can work on it. If it does not exist, create the file. You must use a pure text editor when working on this file. You cannot use a word processor. Any errors or embedded code will cause your site to crash with an error 500.

The first method simply tells the server to run all htm and html files through the PHP processor. Just add the following directive to the .htaccess file. There are two variations, depending upon how the server has been configured. Some trial and error testing is required to see which method works with your server configuration.

This code should work on most Apache servers that are configured to run PHP as a module.
Share this article :

0 komentar:

Posting Komentar

Comments

twitter buttons
 
Support : Creating Website | Johny Template | Mangidos
Copyright © 2011. various articles - All Rights Reserved
Template Created by Creating Website Published by mangidos
Proudly powered by Various articles