Making PHP/CGI appear as HTML
“Once in a way, I get the occasional query from visitors to thesitewizard.com asking how they can hide their CGI or PHP scripts so that while the visitor thinks he/she is receiving a page like http://example.com/pagename.html, he/she is actually getting the output of your script at http://example.com/scriptname.cgi. The URL that is displayed in the visitor’s browser remains “pagename.html”, but the web server actually executes “scriptname.cgi”. There are a few ways in which this can be accomplished without the visitor knowing any different. This article will show you a couple of methods, depending on what you’re trying to accomplish.
System Requirements
For the methods listed below to work, the following are required:
1. Your site must be hosted on an Apache Web Server.
2. The server must be configured to allow .htaccess overrides.
3. For the first method listed below to work, the Apache module mod_rewrite must be installed.
A. Masking Individual Dynamic Pages as Static Pages
Steps to Changing the File Type Without Changing the Extension
This section deals with one way to make certain dynamically generated pages appear as static HTML pages. To mask, say, http://example.com/scripts/scriptname.php as http://example.com/scripts/pagename.html, take the following steps:
1. Use an ASCII text editor and type in the following lines:
RewriteEngine on
RewriteBase /scripts/
RewriteRule ^pagename\.html$ scriptname.php [T=application/x-httpd-php]”
Read the full article Thesitewizard.com to see the rest of the instructions.
