.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

作者 铁血 汉子 2018年3月28日
2024/04/26/11:38:45pm 2018/3/28/10:58:39
0 1503