.htaccess
1.如果只是针对特定某一个文件
RewriteEngine On RewriteRule something something.php [L]
http://example.com/something访问的文件为http://example.com/something.php
2.针对所有的php文件
RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule (.*) $1.php [L]
3.其它方式(是否有效未做验证)
路径/etc/apache2/apache2.conf
添加DefaultType application/x-httpd-php
如果想要解析为其他后缀
AddType application/x-httpd-php .ext