为什么要在网址中添加"/something/watever"在"page.php"之后不会触发404? [英] Why adding in the url "/something/watever" after a "page.php" doesn't trigger a 404?
问题描述
我有一个网址为site.com/index.php
的网页.奇怪的是,当我在URL中添加/something/whatever
(或其他任何内容)并将其设置为site.com/index.php/something/whatever
时,index.php
页面仍在加载.
I have a webpage with url site.com/index.php
. The strange thing is, that when I add /something/whatever
(or anything else) to the URL, making it site.com/index.php/something/whatever
, the index.php
page is still loading.
我不明白为什么服务器不仅仅返回 404 Not Found错误.
I don't get why the server isn't just returning a 404 Not Found error.
我尝试过其他站点,例如php.net
.您可以尝试继续 https://www.php.net/manual/en/intro-whatcando.php/,
I've tried other site, like php.net
. You can try to go on https://www.php.net/manual/en/intro-whatcando.php/,
Then add after the /
something, like this: https://www.php.net/manual/en/intro-whatcando.php/test/like/test/fuhzefuizh.
我仍然不明白为什么它显示page.php
而不是404错误(因为显然,文件夹或URI"fuhzefuizh"不存在).
I still don't get why it's showing the page.php
and not a 404 error (because obviously, folder or URI "fuhzefuizh" doesn't exist).
推荐答案
我怀疑这是正常现象,具体取决于服务器配置.这是AcceptPathInfo
规则,我们可以使用AcceptPathInfo off
将其关闭.
I have foud that it's a normal behaviour depending the server configuration. It's the AcceptPathInfo
rule, we can just turn it off with AcceptPathInfo off
.
这篇关于为什么要在网址中添加"/something/watever"在"page.php"之后不会触发404?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!