Apache .htaccess password protect with relative path

Sabya picture Sabya · May 13, 2009 · Viewed 7.2k times · Source

I want to create a .htaccess file in my DocumentRoot, so that the directory is password protected.

But the password file, I want to specify by using the relative path of DocumentRoot.

So, if I am checking out the code in another system, it just works as it is. The password file will be part of my source control.

How can I access the parent directory of the DocumentRoot from .htaccess file?

Answer

Gumbo picture Gumbo · May 13, 2009

I don’t think that’s possible. The AuthUserFile directive requires the file-path to be either absolute (thus from file system root) or relative from the server root.