UnixServerAdmin

Server Administration & Management

How to remove the .html extension from the URLs using .htaccess

If you want to  remove the  .html extension from  URL’s then just add the below code in the .htaccess file :

===============================
Options +FollowSymLinks
Options +Indexes
RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([^.]+)$ $index.html [NC,L]
===============================

That’s all this will do it.

May 22, 2011 Posted by | Apache, htaccess | , , | 1 Comment