a digital blog


Hide .php extension with url rewriting using .htaccess

This post explains how to Hide .php extension with url rewriting using .htaccess file and also it will improve your Web projects security.

For rewriting the URL, you should create a .htaccess file in the root folder of your web directory. And have to put the following codes into htaccess file.

Sample .htaccess

RewriteEngine on
RewriteRule ^(.*)\$ $1.php [nc]

It will rewrite the index.php to index.html i.e when a URL like http://www.91weblessons.com/index.html is called in address bar it calls http://www.91weblessons.com/index.php. Here [nc] means not case sensitive.


  1. Thank you for the sensible critique. Me & my neighbor were just preparing to do some research about this. We got a grab a book from our area library but I think I learned more from this post. I am very glad to see such fantastic info being shared freely out there.

  2. That is a really good tip particularly to those new to
    the blogosphere. Brief but very precise information… Thanks for sharing this
    one. A must read post!

  3. Best wishes!Your blog is very good!


Copyright © 91 Web Lessons - a digital blog