Assigning AuthName for a different directory


#1

Without going into all the details why, I’d like to define AuthName for a directory from outside that directory (i.e. not using the htacess file within that directory). I tried to do this using a directive from the parent directory but this produces this error message “/path/to/.htaccess Directory not allowed here”. Does anyone have another idea how I can go about this or if you can use Directory directive from ANYwhere within the hosted domain?
Thanks!


#2

You can only use in Apache’s global or VirtualHost configuration. .htaccess, being per-directory configuration files, must go in the directory you want the configuration to affect (there are exceptions, but not for what you’re doing).


If you want useful replies, ask smart questions.


#3

kchrist - thanks for telling me what I didn’t want to hear! :slight_smile: Any other ideas about how I could assign AuthUserFile from outside a directory? (I meant to say AuthUserFile rather than AuthName in subject.)


#4

Use a symlink?

AuthUserFile /home/username/symlink-file

/home/username/symlink -> /home/username/user-file

Then all you have to do is update the symlink to point to different files and not have to edit the .htaccess file anymore. Uh, as if it would be much harder to just rewrite the user file in the first place, but oh well. Probably depends on how often you need to switch files or update the user list; updating the symlink might be more atomic…uhm, haven’t checked yet if a symlink will work (perhaps restricted for security reasons)

:cool: Perl / MySQL / HTML+CSS