0

I have a website running on PHP. I want to remove the .php suffix from all of my webpages in such way that the user doesn't get to know what server side language is running.

How do I edit the displayed address in the address bar to not show the .php ?

Ruslan Osmanov
  • 20,486
  • 7
  • 46
  • 60
user434885
  • 1,988
  • 6
  • 29
  • 51

2 Answers2

1

With mod_rewrite in .htaccess:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L] 
Ivar
  • 4,344
  • 6
  • 38
  • 53
0

Apache has a feature, 'MultiViews' that allows the server to choose the correct extension when none is supplied. In your .htaccess or httpd.conf, you can add this:

Options MultiViews

If you have a file at /path/to/blah.php, it can be accessed as merely /path/to/blah.

Delan Azabani
  • 79,602
  • 28
  • 170
  • 210