GIDForums  

Go Back   GIDForums > Web Hosting Forums > Apache Web Server Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 01-Jan-2004, 11:39
toadatrix toadatrix is offline
New Member
 
Join Date: Nov 2003
Posts: 4
toadatrix is an unknown quantity at this point

Overriding .htaccess


I 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  
Old 02-Jan-2004, 13:02
nickbeee's Avatar
nickbeee nickbeee is offline
Junior Member
 
Join Date: Aug 2001
Location: Nottingham, UK
Posts: 80
nickbeee is on a distinguished road
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  
Old 02-Jan-2004, 22:00
toadatrix toadatrix is offline
New Member
 
Join Date: Nov 2003
Posts: 4
toadatrix is an unknown quantity at this point
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 GIDBlogToyota - 2008 July Promotion by Nihal

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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

All times are GMT -6. The time now is 04:12.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.