Is there a way to force apache to return 404 instead of 403?

RedirectMatch as in e.g.

RedirectMatch 404 /\.

does the trick, it prohibits access to all files or directories starting with a dot, giving a “404 Not Found” error.

From the Apache manual: “The Redirect[Match] directive maps an old URL into a new one by asking the client to refetch the resource at the new location.” By default, Redirect sends a 302 return code, but it can also return other status codes as shown above.

Leave a Comment