How to remove the .html or .php in the website url

How to remove the .html or .php in the website url
If you have the website in the html or PHP page. If you open the web page replaces the .html are .php extension in your web page URL. Because url will not easy to reminder. Like you have the your like www.domainame.com/about.html means is not easy to remind because of with the extension. User confused with an extension because of there are lots of extensions in the web page like .html, .htm, .php, .aspx, .js like that. How to solve this.

In the Linux hosting server .htaccess file will be available in the root directory. Using this file you can remove this extension in your web page url. What is .htaccess file. An .htaccess file is a simple ASCII file that you create with a text editor like Notepad or TextMate. It provides a way to make configuration changes on a per-directory basis.

Features
With an .htaccess file you can:
Redirect the user to different page
Password protect a specific directory
Block users by IP
Preventing hot linking of your images
Rewrite URIs
Specify your own Error Documents

Code for how to remove the .html are php from web page url. Copy the below code to remove the .php from the url. Where you find the .htaccess file in your hosting. GOTO root folder in your Linux host and enable the hidden files option to display the hidden files on your hosting directory. It will show the hidden files and htaccess file. Open the file and copy the below code and past into the file.

For PHP
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]

For HTML
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.html [NC,L]

Save the file and refresh the file now can not see the any extension in your url.
Copyright Labw3