在xampp中自动获取php扩展

时间:2010-01-22 13:32:19

标签: php

我正在使用xampp

htdocs中保存的所有项目都在http://localhost/projectname/filename.php

中打开

我希望当我输入

时,有任何方法可以这样做
http://localhost/projectname/filename and open that page 

表示无需在文件中写入.php扩展名(默认扩展名应为php)

1 个答案:

答案 0 :(得分:1)

你可以使用mod_rewrite。在.htaccess

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.+) $1.php [L]