Saturday, 17 August 2013

403 error just for directory, and not files in the directory

403 error just for directory, and not files in the directory

Let's say I have a directory on my site...
http://test.com/images/
...and I want to show a 403 forbidden error if somebody tries to access
it. So I would use....
ErrorDocument 403 /403.shtml
...in the .htaccess file in my main directory. However, how could I make
it so that it just displays the 403 error when the user is trying to view
the directory directly. So if I wanted to visit...
http://test.com/images/test.png
...it would work and I could see the image, but if I visited
http://test.com/images/, I would get a 403 error. How can I accomplish
this?

No comments:

Post a Comment