# Access to subfolder

**URL:** <https://www.ruby-forum.com/t/access-to-subfolder/221439>\
**Category:** NGINX\
**Created:** [July 14, 2012, 5:00pm UTC](https://www.ruby-forum.com/t/access-to-subfolder/221439 "2012-07-14T17:00:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [July 14, 2012, 5:00pm UTC](https://www.ruby-forum.com/t/access-to-subfolder/221439/1 "2012-07-14T17:00:17Z")

</div>

I have site protected by password:  
location / {  
auth\_basic …  
…  
}

but I need excluded some folder ex. /a/b/c/ from authentication

it is possible ?

Posted at Nginx Forum:

> **[Access to subfolder](https://forum.nginx.org/read.php?2,228587,228587#msg-228587)**
>
> I have site protected by password: location / { auth\_basic ... ... } but I need excluded some folder ex. /a/b/c/ from authentication it is possible ?

---

<div class="post-metadata">

**Author:** ![lukasz138](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/c57346/32.png) [@lukasz138](https://www.ruby-forum.com/u/lukasz138)\
**Post date:** [July 14, 2012, 5:07pm UTC](https://www.ruby-forum.com/t/access-to-subfolder/221439/2 "2012-07-14T17:07:52Z")

</div>

On Sat, Jul 14, 2012 at 9:59 PM, lukasz138 [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I have site protected by password:  
> location / {  
> auth\_basic …  
> …  
> }
> 
> but I need excluded some folder ex. /a/b/c/ from authentication
> 
> it is possible ?

Yes. Just add another location where you don’t want to use  
authentication, optionally prefixing it by ^~[1]:

location ^~ /a/b/c/ {  
…  
}  
location / {  
auth\_basic …  
…  
}

[1] [Module ngx\_http\_core\_module](http://nginx.org/r/location)

---

<div class="post-metadata">

**Author:** ![lukasz138](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/c57346/32.png) [@lukasz138](https://www.ruby-forum.com/u/lukasz138)\
**Post date:** [July 14, 2012, 6:58pm UTC](https://www.ruby-forum.com/t/access-to-subfolder/221439/3 "2012-07-14T18:58:17Z")

</div>

ok, but I want to access to any subfolder behind /a/b/c/, example  
/a/b/c/d or /a/b/c/test.html . Any solution ?

Posted at Nginx Forum:

> **[Re: Access to subfolder](https://forum.nginx.org/read.php?2,228587,228590#msg-228590)**
>
> I have site protected by password: location / { auth\_basic ... ... } but I need excluded some folder ex. /a/b/c/ from authentication it is possible ?
