Forbidding access to a directory.
Moderator: General Moderators
Forbidding access to a directory.
How do I forbid access to a specific directory on my web server? I have a bunch of videos located in a directory on my server that I want to allow only members of my site to be able to view. I'm authenticating members with PHP sessions, and I want the videos to be accessible only through a PHP page with this authentication.
I appreciate any assistance on this.
Thanks for reading.
I appreciate any assistance on this.
Thanks for reading.
I googled "htaccess forbidding directory" and found that if an .htaccess file has this statement:
then all files in the same directory as the .htaccess file will be forbidden access to everyone. It doesn't appear to have any effect on my directory at all. Am I doing something wrong?
Code: Select all
deny from all- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
Nope, it's correct.That didn't do it either. Is it that I misspelled the file extension: .htaccess?
That's what it should do.Does "Deny from all" not deny access to the all of the directory's files and subdirectories?
Does your server have mod_access? Also, try putting gibberish into the htaccess file and see if you get a 500 error.
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
Could it be that my file only consist of:
?
EDIT: Also when I change my file to:
I get an Internal Server Error
Code: Select all
Deny from allEDIT: Also when I change my file to:
Code: Select all
<IfModule mod_access>
Deny from all- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
Okay I contacted my hostie and found out that it is enable and that, for some WEIRD reason, it works but when I go to try accessing it on this computer it doesn't... weird.
I tested on my other computers and it works. Why on this computer would it have access?
EDIT: It was my cache.
I tested on my other computers and it works. Why on this computer would it have access?
EDIT: It was my cache.
Last edited by JellyFish on Fri Jun 29, 2007 8:34 pm, edited 1 time in total.
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
Exactly. Well, thanks for all help peoples.Ambush Commander wrote:Mmm... try clearing your browser cache?
This would protect people from downloading or viewing the files in the directory as the .htaccess, but not restrict the files from being viewed with and mp3 player for example, right?
EDIT: In other words, it's secure?