Hide PHP extension in URL using .htaccess

Server Administration | February 7th, 2010

What?

Hide the .php extension of your PHP files in the URL of your site address.

Instead of:
http://www.example.com/page.php
Visitors to your site will see:
http://www.example.com/page/

Why?

There are actually quite a few reasons to do this.

  • Make your URLs cleaner and easier to remember for visitors
  • Make dynamic pages appear static for SEO
  • Security by obscurity (albeit very weakly so)—visitors cannot tell as easily that you are using PHP
  • For fun (yay!)

(more…)