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 am having a problem with Apache. What it does is this: Take /index.php file containing an code with src set to relative path myimg.jpg, both in the root of my server. So, would show the image as would

However, if I access (with a trailing slash) it does the odd thing of executing index.php code as it would be inside an index.php folder (e.g. /index.php/index.php), thus not showing the image anymore.

This is a simple example that's easy to solve with absolte addressing etc, the problem I am getting from this a security one that's not so easily fixed.

So, how can I get Apache to give a 403 or 404 when files are accessed "as folders"?

Thank you.

share|improve this question
up vote 1 down vote accepted

"AcceptPathInfo off" would prevent Apache from mapping a request to /index.php/ to index.php + PATH_INFO of "/".

share|improve this answer
Thank you, covener. Is that a .htaccess directive or httpd.conf one? – Francisc Feb 24 '11 at 11:53
It's accepted in either context, – covener Feb 26 '11 at 19:23
Thank you. [fill-in chars] – Francisc Mar 1 '11 at 11:15

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.