Now a days we see lots of web pages without any page extensions in the Browser’s navigation area. Removing page extension from the end of the URL helps creating search engine friendly URL. Page extensions for websites built using html, css or object oriented programming may easily be removed using .htaccess file. Let’s learn how can we remove page extensions using .htaccess

Step by step guide to remove page extensions using .htaccess

STEP 1: To create a .htaccess file or to make some changes to an existing one, you need to log into your hosting control panel first. If you’re using cPanel see how to log into cpanel.

STEP 2: Once you’re logged in search for ‘File Manager’ under the ‘Files’ section & click on it to manage your files.

STEP 3: In the public_html folder you’ll get a file named .htaccess. Try browsing the hidden files if You don’t see any .htaccess file.  Or create a new one if it doesn’t exist. Open it with a text editor.

STEP 4: Write the following codes in it as the website requires:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html

STEP 5: Save changes before you close the editor.