We see many PHP URLs without .php extension this can easily be achieved simply adding the following code in .htaccess file.
First create a .htaccess file in your server document root where PHP files are placed.
Removing .php Extension from URL
If you need to convert your url from http://domainname.com/blog.php to http://domainname.com/blog. Edit .htaccess file and add following settings.
RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^.]+)$ $1.php [NC,L]
Removing .html Extension from URL
For example you need to convert your url from http://domainname.com/test.html to http://domainname.com/test. Edit .htaccess file and add following settings.
RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^.]+)$ $1.html [NC,L]
Now you can create a PHP file in the same folder and you can access that URL without .php extension.