Removing the Page File Extension From the URL (HTML and PHP Extension).

Removing the page file extension from the URL. In this tutorial you will learn how to remove the page file extension from the URL or cleaning URLs links in your website. First you need to create file called '.htaccess file' where you can write a code.
Example, www.yourdomain.com/about.php or www.yourdomain.com/about.html should look like www.yourdomain.com/about without extension behind it. To do this we will need to create file called .htaccess inside your working folder.
Inside your links you need to remove .html or .php extension (i.e. about.html to “<a href="about">About Us</a>” or about.php to “<a href="about">About Us</a>”).
Here the sample of ‘about’ page;
<html>
<head>
<link rel="stylesheet" href="style.css" media="All">
</head>
<body>
<div id="Navigation">
<ul id="ul">
<li><a href="about">About Us</a></li>
</ul>
</div>
<div id="About">
</br><p>
<h3>
Hey Every One
</h3>
<h3>Enjoy this tutorial</h3>
</p>
</div>
</body>
</html>
For the file with .html extensions,use the code below;
//Re-write starts
RewriteEngine on
//If the folder exists on the server then don’t change the rule
RewriteCond %{REQUEST_FILENAME} !-d
// check the file in directory with .html extension
RewriteCond %{REQUEST_FILENAME}\.html –f
// Show the page that has .html extension
RewriteRule ^(.*)$ $1.html [NC,L]
For the file with .php extensions, use the code below;
//Re-write starts
RewriteEngine on
//If the folder exists on the server then don’t change the rule
RewriteCond %{REQUEST_FILENAME} !-d
// check the file in directory with .php extension
RewriteCond %{REQUEST_FILENAME}\.php –f
// Show the page that has .php extension
RewriteRule ^(.*)$ $1.php [NC,L]
NOTE:It works for online server not for local server.