A subdirectory /var/www/vhost/servername/httpdocs/subdir/of an apache (ver. 2.2.22 on ubuntu 12.04) vhost webroot is a disk partition of its own. Accordingly, there is also /var/www/vhost/servername/httpdocs/subdir/lost+found. In my apache error logs I find errors that /var/www/vhost/servername/httpdocs/subdir/lost+found/.htaccess cannot be read, with a referer like /var/www/vhost/servername/httpdocs/subdir/foo/ (i.e. when a FancyIndexing directory index of that dirctory is displayed to the user).

[Fri Nov 28 09:14:19 2014] [crit] [client] (13)Permission denied: /var/www/vhost/servername/httpdocs/subdir/lost+found/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable, referer: http://servername/subdir/foo/

I cannot make sense of this. Why would apache try to read

  • /var/www/vhost/servername/httpdocs/subdir/lost+found/.htaccess

on that occasion? In my understanding it should only have reason to try to read

  • /var/www/vhost/servername/httpdocs/subdir/foo/.htaccess
  • /var/www/vhost/servername/httpdocs/subdir/.htaccess
  • /var/www/vhost/servername/httpdocs/.htaccess

Interestingly, no corresponding error messages occur with deeper subdirectories (e.g. http://servername/subdir/foo/bar/baz/).

What causes this error (or the read attempt in the first place)? And how can I get rid of it?

1 Answer 1


Apache will try to find .htaccess files in every directory, but lost+found is usually readable by root only, so it can't even check if a file is there.

One solution is to mount the disk somewhere else, move the data into a subdir of that mountpoint and then either symlink or bind-mount that subdir it into place. This way, lost+found isn't in the directory tree Apache searches.

  • Could you be more specific about the word "every"? I presume it will never try that outside the docroot, to begin with. Would it want to check (webroot)/bar/bar/bar/.htaccess to display (webroot)/foo/foo/foo/? Commented Nov 28, 2014 at 14:55
  • Now I see: The referer in the log entry is not the page generating the error. Instead, it is the page from where we came to the page that generated the error - the page generating the error is not mentioened in the error log entry. And in fact the error ws generated when going to the "Parent directory" from a subdirectory (which explains why no deeper directories occur in the error.log). In that case, apache checks if (and how) it shold display lost+found. Instead of moving the data around as Sven suggested, an additional line IndexIgnore lost+found helped as well. Commented Nov 28, 2014 at 20:14
  • ... and performance-wise, Sven's suggestion is certainly better. Commented Nov 28, 2014 at 20:15

You must log in to answer this question.

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