![]() |
|
#1
|
|||
|
|||
Overriding .htaccessI use .htaccess to password protect my website and that works great. My directory structure for the site is as follows:
/var/www/localhost/htdocs Where htdocs is the first subdirectory that the apache2 server can access. I put my .htaccess file in the htdocs directory and, like it should, it protects that directory and all the various sub-directories I have beneath the htdocs directory. Now here is the problem, I want to put a public sub-directory immediately beneath htdocs which will not require a password to access. All other files and directories below htdocs should still require the password for access. In other words, I want one single sub-directory of htdocs to be exempt from password protection. I tried to do this with the following .htacess file but it keeps giving me a server configuration error: AuthType Basic AuthName "Entry to this site is by invitation only!" AuthUserFile "/var/www/localhost/htdocs/.htpasswd" require valid-user # # ---Allow only one public directory with no password needed for access--- <Directory /var/www/localhost/htdocs/public/*> Order Deny,Allow Allow from All </Directory> How can I configure .htaccess to restrict all but the public sub-directory? Thanks for your help. |
|||
|
#2
|
||||
|
||||
|
As I understand it the .htaccess files is used on a per-directory basis rather than globally, so you may need more than one of them.
Have you read the appropriate section in the manual? http://httpd.apache.org/docs-2.0/howto/auth.html __________________
Nick B. http://www.nowindows.net http://www.mozilla.org |
|
#3
|
|||
|
|||
|
Thanks, I figured it out. The following seems to work just fine if added to the apache config file:
### ###-------------------------------------------------------- ### Setup a public directory without any password needed for access. ### This "public" directory will be accessable even ### if .htaccess is installed ### in a higher level (i.e., "htdocs") directory. ### Alternatively, you could omit this statement and ### simply add an .htaccess file to the "public" ### directory which would contain only the two lines: ### Allow from all ### Satisfy any ### <Directory "/var/www/localhost/htdocs/public/"> Allow from all Satisfy any </Directory> |
Recent GIDBlog
Vista ?Widgets? on Windows XP by LocalTech
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| .htaccess on Windows2k, and the trailing slash | Pedster2k | Apache Web Server Forum | 6 | 24-Jan-2004 17:32 |
| .htaccess language / rewrite problem | spinflip | Apache Web Server Forum | 5 | 15-Dec-2003 14:14 |
| .htaccess - allow IP addresses- how to? | dadpups | Apache Web Server Forum | 3 | 18-Nov-2003 09:01 |
| Problem with .htaccess | Zergus | Apache Web Server Forum | 7 | 29-Jul-2003 11:01 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The