Remove File Extension from URL

May 22, 2013 Htaccess

A htaccess (hypertext access) file is a directory-level configuration file supported on web servers .htaccess is the file  extension. You can create through a text editor like NotePad or SimpleText. With htaccess file we can change & remove web url file Extension like

Before without htaccess url

After with htaccess url

There is a ways to do this. Open your HTML editor and create a New file Name “.htaccess” copy the following code in it, and upload it to your site’s (.htaccess is the file extension. It is not file.htaccess or somepage.htaccess, it is simply named .htaccess) root directory (webserver).

Following Code

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