overriding password in subdirectory

suklee

Diamond Member
Oct 9, 1999
4,575
10
81
I have a htaccess/htpasswd protecting my root directory i.e. public_html/

What I want is to have a subdirectory excluded from this authentication, i.e. public_html/test - everyone should be able to connect without typing in any password.

I found this thread http://www.webmasterworld.com/forum92/1137.htm but when I access the subdomain test.mydomain.com (which is really public_html/test) it still asks me the password for the root password.

Any ideas? Here is what I have in my htaccess (root)

SetEnvIf Host "^(www\.)?test\.mydomain\.com" openhost
AuthType Basic
AuthName Testing
AuthUserFile /home/mydomain/public_html/.htpasswd
Satisfy any
Require user user1
Order allow,deny
Allow from openhost

PS. Just got reply from Bluehost that this is impossible?
 

DaveSimmons

Elite Member
Aug 12, 2001
40,730
670
126
Can you map www. to a subfolder too?

(folders not URLs)
../ = anonymous
../test = anonymous
../www = protected
 

Jaskalas

Lifer
Jun 23, 2004
35,829
10,130
136
Ran a quick search through google on this subject, and just tested it on my server and saw that it worked. While I'm not sure what all of its ramifications are, the following method WILL open up your folder to the public while its parent folder is secured.

Add the following line:
Satisfy any
to your .htaccess file.

*edit

As I see that you already have that line in your example, you may want to try that line by itself, with no other lines of code in the .htaccess file.
 

suklee

Diamond Member
Oct 9, 1999
4,575
10
81
Wow, nice Google work! I used only that line and surprise surprise, it does let me in at the subfolder without password! The root is still pw protected.

Let me ask the folks at Bluehost if they know any negative ramifications of this.