且构网

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

在不使用 mod_rewrite 的情况下运行没有扩展名的 PHP?

更新时间:2023-09-12 18:11:34

另一种方法是使用 内容协商.打开多视图:

An alternative is to use content negotiation. Turn on multiviews:

Options +MultiViews

如果命名资源不存在,Apache 将搜索该文件,然后根据浏览器发送的媒体类型和内容编码要求进行排序.如果只有一个文件(您的 PHP 脚本),则 URL 将解析为该文件.

If a named resource doesn't exist, Apache will glob for the file, then sort based on the media type and content encoding requirements send by the browser. If there's only one file (your PHP script), then that's what the URL resolves to.