Why is www.example.com/index.php/my/path/here handled by index.php?

I'm just curious about the name of the apache function, which directs requests like this

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

to the index.php file? At the first moment, you might think that it would be right if this request leads to a 404 error page, because there is no folder in the root directory of the site called index.php.

By the way, is it possible to disable this Apache function (if it is a function) so that such requests actually end in 404?

+3
source share
3 answers

URL. , , . . AcceptPathInfo:

, , , ( ) . PATH_INFO .

, , /test/ , here.html. /test/here.html/more /test/nothere.html/more /more PATH_INFO.

CGI.

  • PATH_INFO

, . , , . PATH_INFO. , URL , CGI script.

+10

.

( ) index.php script , , "URL-, " ".

, , URLS index.php .

+2

It is there that you can have a file like index.php, check PATH_INFO from the server and process the whole content tree. Although I don't know how to do this, you can simply check index.php for a non-empty $ _SERVER ['PATH_INFO'] and respond with 404 code using the header () function.

+1
source

Source: https://habr.com/ru/post/1725507/


All Articles