Help: Parse pages with extension PHP into HTML

CNC Technical support Oracle ERP1 Peoplesoft JdedwardsRequest quote for CNC tecnical support of Peoplesoft Oracle JDE technical supportQualifications of CNC Technician for Oracle  ERPContact CNC Technical support

 

 

MORE TUTORIALS SCRIPTS AND HELP FOR WEBMASTERS

Tutorial Mod rewriteThe viXML script
Parse web search results
Using Gigablast XML services

Convertir PHP en HTMLPHP: local variables
How use local variables
with register_globals off

Convertir PHP en HTMLJavascript and PHP
How run PHP with Javascript
using JS Onclick

PHP y JS funcion OnclickToolbar design
Custom toolbars for Internet Explorer and Mozilla
Use toolbars to enhance user loyalty and affiliates CPM

PHP para ocultar email con imagenData extraction service
Data mining and scrapping
We provide data extraction

 

Hospedaje sitios web con excelentes ventajas!

 

GoDaddy $8.95 Registro de Dominios

 

 

 

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, automatically.

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 PHP pages

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 is HTML

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 notepad.

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

CPANEL

This alternative does not require to create the file .htaccess, only requires that the HOST has CPANEL, go to Apache Handlers Apache handlers and create the next entry:

extension: .html

handler: x-httpd-php

GoToMyPC - Accese remotamente su PC desde cualquier sitio

Credits

This tutorial created by Sergio Vargas, contact me Sergio Vargas weblog - Gallo Pinto

COMMENTS / OPINIONS / ERRORS HERE!!


Parse .PHP into .HTML iconParse .php into .html
Comments about parsing PHP pages into HTML pages
16 Feb 2006

More about Apache directives

viXML is used to parse search engine results, it is free, try!

Powered by viXML, providing custom search results

© Copyright 2005-06. Vlialin Inc.
All right reserved

   Free web templates by MyFreeTemplates.com