0

I am serving a documantation database and link a directory-listing which are located outside of the main directory. Like:

Apache main directory: /var/www/
Files: /scratch/files/

I added the "/scratch/files" in the conf as a directory and in order to view the directories as built-in directory listing. Now I want to protect the parent folders in directory-listing by adding .htaccess files into the linked directory.

This doesn't work because "/scratch/files" is not located in "/var/www".

What would be the easiest/best solution to fix this?

2 Answers 2

0

Location directives should still work fine, since they will even work on things that have no relation to the document root (eg. reverse proxy or redirect entries)...

3
  • Location directives work if they defined in the main apache configuration file. But .htaccess files cannot be read in these directories.
    – Caniko
    Mar 18, 2013 at 13:22
  • Location is meant for resources that are not part of the file system. For just showing files resident on a different part of the file system from the rest of the content, using Directory is the most common way to go about it.
    – Jenny D
    Mar 18, 2013 at 13:26
  • I admit to have read "htaccess like protection" into "via .htaccess" ... the usual mod_auth directives (including using a .htpasswd file) will work in Locations. Mar 18, 2013 at 13:47
0

In the <Directory> directive for /var/www , there is usually some directive called AllowOverride. This is what allows you to set limits in .htaccess in that directory tree. If you want to be able to use .htaccess in /scratch/files, you need to enter the same AllowOverride for that directory.

If you need further help, please post the relevant parts of your config file.

You must log in to answer this question.

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