i wanna be the only one to see the index of a folder

FileSick

Verified User
Joined
Oct 5, 2013
Messages
104
hi

i wanna be the only one to view the index of any folder on my server without adding a password on any folder because there is a downloadable content in these folders and i want anyone with a link to these folders content to be able to download them so could you please help me out ?

http://i.imgur.com/qy4a6eT.png

waiting for your respond
 
There is no way to do that. You could restrict access to it with mod_access but you cant just do that for indexes.

If you use apache 2.4 you might be able to do something like this http://stackoverflow.com/a/10419766

Just change the settings to +Indexes and put your ip.

Example:

Code:
<If "%{REMOTE_ADDR} == 127.0.0.1">
  Options +Indexes
</If>
 
thank you so much for your awesome respond this way and i like the way you talking about but just to be sure

i will be able to login with my ip and only my ip but this will be for the indexes only and anyone with any ip can go to any page on my website except the indexes pages Am i Right ?

if i'm right then thank you very much and could you please tell me where to write the code you gave me ?

waiting for your respond
 
The code would only affect the indexes being shown.

Create a file called .htaccess and put it in the folder where you want to be able to view the indexes.
 
two last questions please

i live in egypt and i'm with a network where they change the ip every single hour do i have to change the ip in the htaccess file or not ?

the index page i want to hide contains many folders i want to hide too is it going to be enough to add one htaccess file to the main directory where the other directories are or htaccess to all of the folders and i have to change the ip for each and everyone i want to access ?

waiting for your respond and thank you so much for your time and help
 
one last thing i promise

right now there .htaccess in that main folder where all the other folders do i need to edit it and add the code you gave me right after the code that already in it right after it or i should start from the next row or create another .htaccess file (but that doesn't make sense)

waiting for your respond
 
If your IP# changes hourly you likely can't use it in an .htaccess file to control access. To protect entire directories you probably need to use password protection in .htaccess; it'll remain working until you close your browser so you'll likely only need to enter it once a day if you keep your browser open. And others will still see the directory if they attempt to access it, but won't be able to get in.

If you only want to protect php files you can use session control.

Your .htaccess file protects not only the directory in which it's placed, but all subdirectories of that directory.

Jeff
 
thank you so much Jeff for your help and time

i want to be the only one to access the indexes under any mean like i don't care what should i do

i tried to password protect it like it is right now but the website contains downloadable content in these subdirectories that i want my users to download password protect directory won't allow my users to download

but the solution you are talking about (.htaccess) thing sounds very promising like a password and only for me and the users can download the content by giving them direct link to the file not the directory am i right ? if i am right please tell me how to set it up this way

a note to scsi please respond to my previous replies and explain more your method i just talked with my network admin and he told me that they can transfer me to another network where i can use one ip for like a day or two so it will be more flexible

thank you so much guys you are the best ever

have a nice day everyone
 
I'm not an expert at .htaccess files, but rather a server aministrator, but the only way I can see of doing this with passwords under .htaccess if if you can have some kind of if/then selection in .htaccess, since otherwise the passwords would protect all sudirectories.

And I don't know if you can do that with .htaccess files.

Hopefully someone else will respond.

Jeff
 
please Mr. Scsi answer my questions and thank you so much Mr. Jeff

waiting for your respond
 
Back
Top