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, www.mysite.com would show the image as would www.mysite.com/index.php.

However, if I access www.mysite.com/index.php/ (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.

link|improve this question

75% accept rate
feedback

1 Answer

up vote 1 down vote accepted

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

link|improve this answer
Thank you, covener. Is that a .htaccess directive or httpd.conf one? – Francisc Feb 24 '11 at 11:53
1  
It's accepted in either context, httpd.apache.org/docs/current/mod/core.html#acceptpathinfo – covener Feb 26 '11 at 19:23
Thank you. [fill-in chars] – Francisc Mar 1 '11 at 11:15
feedback

Your Answer

 
or
required, but never shown

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