Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I found a problem with my Apache webserver:

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

When I access the URL using this way: or

Apache will display the content of:

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.


share|improve this question
That sounds like you may have forgotten to configure something and are encountering intended behavior, but a bug. Not familiar enough with Apache to know what though. – Jeff Welling Apr 5 '12 at 18:14
Thanks. Do you know which Apache settings I should look into? – Derrick C. Apr 5 '12 at 21:29
Can you clarify what behavior you're expecting? What should Apache serve, if not index.php? – Shane Madden Apr 6 '12 at 2:35

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.

share|improve this answer
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 5 '12 at 21:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.