Converting or hiding .php and replace with .html file extension using .htaccess is the process of Rewriting your URL. Before we could start doing that, first enable your mod_rewrite in your apache.
What is .htaccess file? How to enable how to mod_rewrite module in apache installed under windows environment. 1) Find the “httpd.conf” file under the “conf” folder inside the Apache’s installation folder. To begin wit, create a file name ".htaccess" on your root directory of your website. Insert the the codes below on the .htaccess file if you have already an .htaccess file copy and paste the codes on your .htaccess, insert it below the existing .htaccess codes. To make things easier download the sample script below...
.htaccess files can give you extra control over your server, allowing you to password protect directories, enable server side includes, generate custom error messages, and block users by IP address among other things. An htaccess file is a simple ascii text file which you create or edit in a text editor. The dot (.) before the word htaccess indicates that .htaccess is a file extension. Some text editors will add on an additional .txt file mextension when you save your document.
2) Find the following line “#LoadModule rewrite_module modules/mod_rewrite.so” in the “httpd.conf” file.You can do this easily by searching the keyword “mod_rewrite” from find menu.
3) Remove the “#” at the starting of the line, “#” represents that line is commented.
4) Now restart the apache server.
5) You can see now “mod_rewrite” in the Loaded Module section while doing “phpinfo()”.
# put this .htaccess file to your site root directory #
Options +FollowSymLinks
# start the Rewrite Engine or Rewrite Mode #
RewriteEngine On
# check the url if it has an extension of .html #
RewriteCond %{REQUEST_URI} \.html$
RewriteRule ^(.*) index.php
Please feel free to make a comment and suggestion on this tutorial. Your comment and suggestion will help improve the tutorial for the benefit of you and others. Thank you...