UnixServerAdmin

Server Administration & Management

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

If you want to  remove the  .php  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.php [NC,L]
================================

That’s all this will do it.

Advertisements

May 21, 2011 Posted by | Apache, htaccess | , , | 3 Comments