0

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]

2 Answers 2

6

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");
  //...
0
1

Try using RedirectMatch, like this:

RedirectMatch   404     ^/phpmyadmin(/.*)?$
RedirectMatch   404     ^/server-status(/.*)?$

but you sould write one line per resource to "hide"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .