You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Tanner Bachman <tb...@mtharley.com> on 2009/09/16 17:22:52 UTC

[users@httpd] Handling Error Codes

Hi Everyone, 

This is my first post to this list, so I apologize if this question has already been addressed. 

I am currently running Apache 2.2.9 on a Windows XP SP3 box (development machine). I have a certain directory that appears in all of my virtual hosts as part of the backend servlet engine. I have added the following to my Apache httpd.conf file: 

<Location /some/directory> 
Order deny,allow 
Deny from all 
Allow from 127.0.0.1 
</Location> 

This works perfectly to prevent any public users from accessing that directory on my site. However, when I visit that directory on the site, I get an Error 403 (Forbidden). Obviously, this gives away the fact that that directory even exists. As such, I would also like to take a kind of "Security by Obscurity" approach by forwarding all Error 403 requests to Error 404. If possible, I would like to avoid messing with mod_rewrite and really don't want to create custom error pages for every error...although I will if that's the best solution. So, is there some kind of code that I can use that will just forward those requests to another error template? 

EXAMPLE: 

<Location /some/directory> 
Order deny,allow 
Deny from all 
Allow from 127.0.0.1 
ErrorDocument 403 some code to forward it to ErrorDocument 404 
</Location> 

Any help will be much appreciated! :-) 

Thanks, 

Tanner