Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Web Hosting Forum


You are currently viewing our Web Hosting Forum as a guest. Please register to participate.
Login



Reply
Can I create an "unprotected" directory within a "protected" directory?
Old 06-15-2011, 08:24 AM Can I create an "unprotected" directory within a "protected" directory?
TWD
TWD's Avatar
King Spam Talker

Posts: 1,190
Trades: 0
So I have a directory that is access protected via .htaccess like so:

Code:
AuthType Basic
AuthName "downloadables"
AuthUserFile "/home2/myaccount/.htpasswds/public_html/music/downloadables/passwd"
require valid-user
but under my "/downloadables" directory there is also an "downloadables/images" directory
that I want UNPROTECTED so I
can render images on the page.
It's a Drupal thing.

Anyway, is there a way with .htaccess to permit the subdirectory to all
users while keeping the parent directory password protected.
I'm guessing that I just need to add an additional .htaccess file
in the subdirectory, but what would the code be?

Any help?
__________________
RATE-MY-WEBSITE.com "Free website reviews by real web professionals"
Please login or register to view this content. Registration is FREE
TWD is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-15-2011, 09:39 AM Re: Can I create an "unprotected" directory within a "protected" directory?
andrei155's Avatar
CEO of BLD Hosting

Posts: 1,514
Name: Andrei
Location: Canada
Trades: 6
Use:

Quote:
Satisfy any
In the .htaccess file of the subdirectory.
__________________
No Overselling Guarantee
Now Includes a Free Domain
BLD Hosting -
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
andrei155 is offline
Reply With Quote
View Public Profile Visit andrei155's homepage!
 
Old 06-15-2011, 10:12 AM Re: Can I create an "unprotected" directory within a "protected" directory?
TWD
TWD's Avatar
King Spam Talker

Posts: 1,190
Trades: 0
Quote:
Originally Posted by andrei155 View Post
Use:

Satisfy any

In the .htaccess file of the subdirectory.
So you mean the full content of the file would be?:
Code:
Satisfy Any
Allow from all
Would this also work in the Parent directory alone?

Code:
AuthType Basic
AuthName "downloadables" 
AuthUserFile "/home2/myaccount/.htpasswds/public_html/music/downloadables/passwd" 
require valid-user
<FilesMatch "\.(gif|jpe?g|png)$">
Satisfy Any
Allow from all
<FilesMatch>
__________________
RATE-MY-WEBSITE.com "Free website reviews by real web professionals"
Please login or register to view this content. Registration is FREE

Last edited by TWD; 06-15-2011 at 10:15 AM..
TWD is offline
Reply With Quote
View Public Profile
 
Old 06-15-2011, 10:32 AM Re: Can I create an "unprotected" directory within a "protected" directory?
andrei155's Avatar
CEO of BLD Hosting

Posts: 1,514
Name: Andrei
Location: Canada
Trades: 6
That's correct. Your second bit of code however:

Quote:
<FilesMatch "\.(gif|jpe?g|png)$">
Satisfy Any
Allow from all
<FilesMatch>
also needs to be applied in the subdirectory
__________________
No Overselling Guarantee
Now Includes a Free Domain
BLD Hosting -
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
andrei155 is offline
Reply With Quote
View Public Profile Visit andrei155's homepage!
 
Old 06-15-2011, 10:33 AM Re: Can I create an "unprotected" directory within a "protected" directory?
andrei155's Avatar
CEO of BLD Hosting

Posts: 1,514
Name: Andrei
Location: Canada
Trades: 6
You can choose either or. The first opens up the whole directory, while the second just allows specific filetpyes within the directory.
__________________
No Overselling Guarantee
Now Includes a Free Domain
BLD Hosting -
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
andrei155 is offline
Reply With Quote
View Public Profile Visit andrei155's homepage!
 
Old 06-15-2011, 11:25 AM Re: Can I create an "unprotected" directory within a "protected" directory?
TWD
TWD's Avatar
King Spam Talker

Posts: 1,190
Trades: 0
Thanks for that.
Why does the file type info have to to be added in two places?
Doesnt anything in the the .htaccess of a parent directory inherit down to
any child directories?
__________________
RATE-MY-WEBSITE.com "Free website reviews by real web professionals"
Please login or register to view this content. Registration is FREE
TWD is offline
Reply With Quote
View Public Profile
 
Old 06-15-2011, 11:41 AM Re: Can I create an "unprotected" directory within a "protected" directory?
andrei155's Avatar
CEO of BLD Hosting

Posts: 1,514
Name: Andrei
Location: Canada
Trades: 6
It only needs to be added in the subdirectory. You're correct but you have to remember that you want to allow access from "this directory" on. So in this case, your parent directory is the subdirectory.
__________________
No Overselling Guarantee
Now Includes a Free Domain
BLD Hosting -
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
andrei155 is offline
Reply With Quote
View Public Profile Visit andrei155's homepage!
 
Old 06-15-2011, 10:18 PM Re: Can I create an "unprotected" directory within a "protected" directory?
TWD
TWD's Avatar
King Spam Talker

Posts: 1,190
Trades: 0
So what I did in the end was leave the .htaccess file for
the top level directory "as is".

And just added a simple, two line .htaccess file to the directory
immediately below it that I want to unprotect.
Like this:

Code:
Satisfy Any
Allow from all
__________________
RATE-MY-WEBSITE.com "Free website reviews by real web professionals"
Please login or register to view this content. Registration is FREE
TWD is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Can I create an "unprotected" directory within a "protected" directory?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.53040 seconds with 12 queries