gpt4 book ai didi

php - 为什么 www.example.com/index.php/my/path/here 是由 index.php 处理的?

转载 作者:可可西里 更新时间:2023-10-31 23:59:47 27 4
gpt4 key购买 nike

我只是好奇,apache 的功能是如何调用的,它是这样引导请求的

www.example.com/index.php/my/path/here

到一个文件index.php?一开始,您可能会想,如果此请求导致 404 错误页面,那将是正确的,因为在站点根目录中没有名为 index.php 的文件夹

顺便说一句,是否有可能关闭此 Apache 功能(如果它是一个功能)以便此类请求真正以 404 结束?

最佳答案

这不是 URL 重写功能。或者至少它不需要是。参见 AcceptPathInfo Directive :

This directive controls whether requests that contain trailing pathname information that follows an actual filename (or non-existent file in an existing directory) will be accepted or rejected. The trailing pathname information can be made available to scripts in the PATH_INFO environment variable.

For example, assume the location /test/ points to a directory that contains only the single file here.html. Then requests for /test/here.html/more and /test/nothere.html/more both collect /more as PATH_INFO.

它原本是一个 CGI environment variable .

  • PATH_INFO

The extra path information, as given by the client. In other words, scripts can be accessed by their virtual pathname, followed by extra information at the end of this path. The extra information is sent as PATH_INFO. This information should be decoded by the server if it comes from a URL before it is passed to the CGI script.

关于php - 为什么 www.example.com/index.php/my/path/here 是由 index.php 处理的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1895012/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com