HELP: Parse pages with extension PHP into HTML
How convert pages with extension .PHP to pages with extension .HTML
A classic problem
Let's say you built a site with pages with extensions PHP and now you
want to switch to pages with extension HTML or .HTM, you would have to go
page by page changing the extensions? Not necessarily. There is a trick
through the apache handlers, whenever the site runs on superior Apache
1.3 or superior.
PHP Pages: Basic concepts
By default, the extensions of the PHP pages are .php, which indicates
the server that there is some PHP code embedded to execute. Code HTML is
executed at the client side, thought the browser; the PHP code is
executed at the server side. A page with extension .PHP is handled same
way by the spiders, e.g. google, yahoo, msn, gigablast just index the
pages with extension .php without any problem
However, sometimes webmasters want to convert to .html extensions,
with this technique it is possible to transform any extension into other,
The solution is to remove and reassign the file type handlers
associated with the PHP processor defined by the mod_mime of Apache.
Code PHP in pages Web with extensions HTML
If you use embedded PHP code in a HTML page, the code PHP is ignored,
since the code is not executed by the browser.
The solution is to set up the Server to execute the HTML pages like
The solution allows executing code PHP in the html pages. If any HTML
page does not contain PHP code is fine since the server will not make any
code execution. In fact this page has PHP code embedded and its extension
Minimum requirements for the Apache directives
It is possible that the solution works on a HOST and might not work on
another, which depends on the Apache version or the suPHP version
installed. My test conducted using the Web Host - Lunarpages works well
with the version of Apache 1.3.34 (UNIX).
The Apache, removehandler and addtype directives
The TypesConfig's file specifies the PHP processor and file extension:
x-httpd-php linked to files with extension php. Now we will change the
setting in order to process files with extension .html, as well. First,
the first directive clears the handler with "removehandler" and
then reassign the handler with "addtype"'s directive...
Case 1: using the .HTACCESS file
(Only works with the module suPHP installed).
Find the file .htaccess in the root directory and edit it with
If the file is not there just create it with the notepad editor, note
that notepad editor usually makes a .txt extension. I recommend transferring
the file to the server and then renaming it to .htaccess. Any especial
character inserted in the file will cause a Server Internal Error.
Notice, if you have a subdirectory’s structure, necessarily an
.htaccess should exist at each subdirectory or should be propagated
through an Apache directive.
Include the code below in the .htaccess file:
Possible errors: page sends the user to a download file message
or produce an internal server error. Please proceed with next change.
Case 2 using the .HTACCESS
(Standard version no suPHP).
This version slightly varies the instruction addtype format of Apache;
just try the code below in case that the first format does not work.
Case 3. Using Control Panel of CPANEL
This alternative does not require to create the file .htaccess, only
requires that the HOST has CPANEL, go to Apache Handlers and create
the next entry:
This tutorial created by Sergio Vargas, contact me
COMMENTS / OPINIONS / ERRORS HERE!!
/* --------------cutenews nde blog ------------ */
$news_id = 1140135158;
$category = "21";
$template = "new1_en";
More about Apache directives
is used to parse search engine results, it is free, try!