user434885 user434885 - 1 month ago 8
PHP Question

How to change .php extension of website pages?

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
?

Answer

With mod_rewrite in .htaccess:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]