且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用 .htaccess 重写 URL 以隐藏 PHP 扩展名

更新时间:2022-11-27 17:31:49

这将解决它:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteCond %{REQUEST_URI} !/$
RewriteRule ^(.*)$ $1.php

如果它不起作用,请更正 Wamp 服务器的设置:


If it doesn't work correct the settings of your Wamp Server:

  1. 左键单击 WAMP 图标
  2. 阿帕奇
  3. Apache 模块
  4. 左键单击 rewrite_module.