Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am looking to send the 404 error code when users try to access forbidden directories. I have the 'deny from all' attched to all private directories, and the following errordocs on the main .htaccess file:

ErrorDocument 404 /404/
ErrorDocument 403 /404/

This sends users to the custom 404 page I have set up, but when I check the request headers, it's still sending a 403 error code. Can I pass a 404 error code through the .htaccess file on forbidden directories?

[Copied over from stackoverflow]

share|improve this question

1 Answer 1

up vote 3 down vote accepted

not a straight answer, but if you have php [ or other server side include scripting ] installed - you can use:

ErrorDocument 403 /404.php

and in 404.php have:

<?php
  header("HTTP/1.0 404 Not Found");
  //...
share|improve this answer
    
Good enough for me, thanks=). –  Corey Hart Sep 15 '09 at 10:35

Your Answer

 
discard

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.