View Full Version : Prevent directory and file access
Cinta April
Apr 15th 2008, 12:47 pm
How do I prevent someone from reading my files by directly typing the url of my file?
PHPGator
Apr 15th 2008, 1:31 pm
if you have a cpanel account you should be able to easily put these protected files in a directory and then password protect the directory.
If you are totally confused but know that you have a cpanel account I will be more than happy to do it for you for $5.00 - $10.00 :)
Vbot
Apr 15th 2008, 7:00 pm
Here is two simple ways which you can do:
1. Create a blank index.html and upload to directory which you don't want to be listed.
2. Create a file named .htaccess and put the following line of text into that file
Options All -Indexes
Then upload it to your public_html directory.
Cinta April
Apr 16th 2008, 3:39 am
doesn't work I seem to be able to read my file. How do I prevent someone from reading my text files when I upload it to a server?
bartolay13
Apr 16th 2008, 5:54 am
please read more about mod_rewrite..
ill post the link later
Vbot
Apr 16th 2008, 5:46 pm
Oops, I thought you want to disable directory listing :D
Here is the actual code that you need.
put this in your .htaccess file:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_REFERER} ^$
RewriteRule \.(txt)$ - [F]
</IfModule>
that will stop people from directly typing the url of my file .txt files, but it doesn't prevent hotlinking though.
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.