Showing PHP files in the browser without the .php extension using .htaccess
If you do not like www.voorbeeld.nl/contact.php and would rather show just www.voorbeeld.nl/contact as the URL and link (while the file is still called contact.php), you can arrange this in the .htaccess file. Put this file in the public_html directory with the following content. You can of course do the same with .html files; just replace .php with .html.
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
Was this article helpful?
