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 »

  1. This really is a terrific write-up. Thank you so much for making the effort to explain all this out for us. It truly is a great guide!

    Comment by Jae Michelin | June 15, 2011 | Reply

  2. I would love to hear all that you know with regards to this subject. You just have scratched the surface of your knowledge about this which is apparent in the way you write. Have you thought about dedicating an entire website in order that people will not overlook everything you must say?

    Comment by filtered water | June 15, 2011 | Reply

  3. I had been truly hoping to find anything at all for this topic and your blogging perfectly suits my current desires. Will you please write more along these lines? Visitors are looking for this information and the type of impartial viewpoint which you supply.

    Comment by great water filters | June 16, 2011 | Reply


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: