Apache does not generate a 404

旧街凉风 提交于 2019-12-02 16:40:24

问题


if I have /faq.php on the server it can also be accessed via /faq.php/nonexistant.gif why? I have made sure MultiViews are disabled. Why does the contents of /faq.php get shown when I access the URI /faq.php/randomstuff.gif? FYI, I have no htaccess file in the same directory.


回答1:


That is called path_info. You can disable it using AcceptPathInfo Off in the apache config. People generally use it as a fake mod rewrite when mod rewrite is not availalble.

http://httpd.apache.org/docs/2.2/mod/core.html#acceptpathinfo




回答2:


/nonexistant.gif will be HTTP "PATH_INFO": http://www.ietf.org/rfc/rfc3875, section 4.1.5

Basically, the webserver will scan "down" a url until it hits an actual file. Anything after that file in the url becomes PATH_INFO.

http://example.com/some/path/leading/to/realfile.php/extra/stuff/that/becomes/path/info
                   ^^^^^^^^^^^^^^^^^^^^--- real directories
                                        ^^^^^^^^^^^^--actual file, scanning stops here
                                                    ^^-----onwards = path_info


来源:https://stackoverflow.com/questions/22490042/apache-does-not-generate-a-404

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!