Allow a subfolder with directory listings
Hi
I am trying to have a subfolder in my VANILLA forum root where my users upload files.
The voodoo in apache's redirect escapes me, and I am hoping someone here could help me out.
When I password protect the folder /stuff with a .htaccess file, the .htaccess in the VANILLA root folder kicks in gives a 404 error (fancy Vanilla error message).
The 404 message reads "Page Not Found
The page you were looking for could not be found."
How can I exclude /stuff from that .htaccess catch-all that ships with VANILLA?
Here is my .htaccess file from the rootfolder (the one that comes with Vanilla forums)
RewriteEngine On
# RewriteBase /
RewriteCond %{REQUEST_URI} !^/snax
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php\?p=$1 [QSA,L]
Here is the .htaccess file I have written for /stuff :
DirectoryIndex index.php index.html index.htm
Options +Indexes
AuthType Basic
AuthName "Got stuff"
AuthUserFile "/home/mywebstuff/.htpasswds/snax.passwd"
AuthGroupFile /dev/null
require valid-user
Hope someone would have a pointer...
Comments
Htaccess is hierarchical, sub directory htaccess overides parent, parent overrides server config. So just add an htaccess file to your subfolder which modifies the desired behavior. Don't touch the forum root htaccess.
Vanilla Wiki, Tastes Great! 31,000 viewers can't be wrong. || Plugin Development Explained
Thanks for your suggestion, but that is precisely what I tried... I placed an extra .htaccess in my subfolder, but when I turn on "AuthType Basic" I'm bein redirected to a VanillaForums404 error message, and when I turn the auth off, I am able to view the indexed folder...
I guess what I really should try and achieve is to create a Mod_Rewrite rule in the root .htaccess that can exclude every action in the /stuff folder... So far I haven't been able to get that working...
I've tried your .htaccess with my "uploads" folder and when I access mydomain/uploads I see the directory listing.
So there is obviously no need to change roots .htaccess.
Afterwards I've created a "stuff" folder, moved the .htaccess over there and surfing to mydomain/stuff gives me a 403 :-o
Sorry I have no solution for that, but maybe that will help you figure out what happened on your server
vanilla does not try rewrite urls to physical directories and files that are readable. This rule specifiable excludes that
-d
for directory-f
for file,!
meaning not.grep is your friend.
show us the .htaccess of the subdirectory
should be something like
grep is your friend.
@x00 : it is at the end of the initial posting
look at the order of
AuthType Basic
it doesn't go at the top.grep is your friend.