Apache trailing slash added to files problem

Posted by Francisc on Server Fault See other posts from Server Fault or by Francisc
Published on 2011-02-23T14:37:46Z Indexed on 2011/02/23 15:26 UTC
Read the original article Hit count: 216

Filed under:
|
|
|

Hello!

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.

© Server Fault or respective owner

Related posts about apache

Related posts about security