Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

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? –  Derek Z. 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
add comment

1 Answer 1

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. –  Derek Z. Apr 5 '12 at 21:27
add comment

Your Answer

 
discard

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.