Second Sighting Logo

Extensionless URIs

Posted in Apache by Tom on the November 26th, 2008

if you want your URI format to be website.com/about/ instead of website.com/about.php then put the following line in a .htaccess file in your websites root folder.

  1. RewriteRule ^(.*)/$ $1.php [nc]

The php part refers to the extension your web pages have. If you had a file called about.html then the line would be

  1. RewriteRule ^(.*)/$ $1.html [nc]

The [nc] at the end means the pattern is case-insensitive so would match both about.html and about.HTML

Leave a Reply