[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 463
  • Last Modified:

Apache .htaccess how do I grant access to everyone for a single subdirectory

I read the docs but couldn't figure it out... I just want to grant access to one sub directory in an otherwise pass-word protected root. Thanks.
  • 3
2 Solutions
This link will give you plenty of examples... http://corz.org/serv/tricks/htaccess.php
I've found just these three lines of code to bypass the authentication of the parent directory.
The .htaccess file in the subfolder should have these lines

Order Deny,Allow
Allow from all
Satisfy any

The “Allow from all” will grant access to this folder. But the line that decides that is ”Satisfy any”. The “Allow from all” gives access to anyone, this effectively neutralizes the Basic Authentication inherited from the parent folder.
But, please note these reasons below to not use .htaccess (copied from Apache's documentation):

There are two main reasons to avoid the use of .htaccess files.

The first of these is performance. When AllowOverride is set to allow the use of .htaccess files, Apache will look in every directory for .htaccess files. Thus, permitting .htaccess files causes a performance hit, whether or not you actually even use them! Also, the .htaccess file is loaded every time a document is requested.

The second consideration is one of security. You are permitting users to modify server configuration, which may result in changes over which you have no control. Carefully consider whether you want to give your users this privilege. Note also that giving users less privileges than they need will lead to additional technical support requests. Make sure you clearly tell your users what level of privileges you have given them. Specifying exactly what you have set AllowOverride to, and pointing them to the relevant documentation, will save yourself a lot of confusion later.

Note that it is completely equivalent to put a .htaccess file in a directory /www/htdocs/example containing a directive, and to put that same directive in a Directory section <Directory /www/htdocs/example> in your main server configuration:
metalaureateAuthor Commented:
Thanks - very helpful.
Thank you for the grade. Hope it worked out.

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now