Score:0

Why is my Apache able to 200 serve .php files that include a trailing slash?

dj flag

Running Apache 2.4.6 with vhosts and PHP 7.2.34 and just discovered a weird problem.

A valid URL on my vhosts, such as http://example.com/exists.php is also able to be served with a trailing slash; e.g. http://example.com/exists.php/.

This is only the case if the file being served ends with .php, not .html, .txt, etc.

There are no mod_rewrite rules affecting the vhosts. My php.ini looks good.

Any ideas? Normal behavior?

Score:1
bm flag

It's normal behavior. You can also add other trailing slashes or letters like:

  • http://example.com/exists.php/path/to/
  • http://example.com/exists.php/otherpath

it's also used by so some PHP frameworks for URL routing without mod_rewrite.

Jeff avatar
dj flag
Been doing this a long time and still learn something new every day. Thanks.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.