1

I found a problem with my Apache webserver:

Suppose I ONLY HAVE ONE file on my website (index.php):

example.com/index.php

When I access the URL using this way:

example.com/index.php/abc or example.com/index.php/123

Apache will display the content of: example.com/index.php

It has created a lot of problem to my web application. How can I make this as a 404 error?

Notice that my Apache is standard/default. I didn't do any modification to my Apache settings. OS is Fedora Linux.

Thanks.

Derrick C.
  • 111
  • 1

1 Answers1

3

this is the correct behavior indeed, as whatever comes after your page will be in PATH_INFO cgi variable used by server side scripting often.

johnshen64
  • 5,865
  • 24
  • 17
  • Thanks. I notice that I can get the "real file path" from $_SERVER variables in PHP. However, it will be a lot of works to redirect all these "bad requests" to good requests using PHP. That's why I like to solve the problem on the Apache side, rather than PHP side. – Derrick C. Apr 05 '12 at 21:27