How to....

alv4

New Member
Messages
321
Reaction score
0
Points
0
I want to make a directory private...
for example to access to images.domain.com appear forbidden and not list all the files...
how i can make this?
 

garrettroyce

Community Support
Community Support
Messages
5,609
Reaction score
251
Points
63
To disable directory listing you can add this to your .htaccess file:
Options -Indexes
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
Do you want to prevent all access (which is what "private" would mean)? Do you rather want to prevent Apache from making directory listings when there's no default index?

For the former, remove read and execute permissions from the directory. For the latter, add an Options -Indexes to the .htaccess file in the directory.
 
Last edited:

garrettroyce

Community Support
Community Support
Messages
5,609
Reaction score
251
Points
63
note that if you remove all access to the folder, images will not be displayed if you put them on your site with the <img> tag.
 

OdieusG

New Member
Messages
50
Reaction score
0
Points
0
In apache, the default for blocking viewing files containing ".hta", which include HTAccess files is this code, which should be able to be formatted for anything you have
Code:
<FilesMatch "^\.ht">
    Order allow,deny
    Deny from all
    Satisfy All
</FilesMatch>
If you want files that are stored on that domain to be inaccessible from outside sources, not really sure.....maybe the Apache documentation may be able to help you there...
http://httpd.apache.org/docs/2.2

This is for the latest Apache release....2.2
 

gomarc

Member
Messages
516
Reaction score
18
Points
18
You may also consider password protecting the directory. It’s very easy to do from your CPanel > Security > Password Protect Directories

15xo4ds.jpg
 

xav0989

Community Public Relation
Community Support
Messages
4,467
Reaction score
95
Points
0
If you want some hotlinking protection, use a php script that takes the name of the image and returns the actual image content. It shouldn't be hard. Next put all your files in a non web-accessible location. This way, you can log each access to each file, you can add a security code to check access is approved, you can had a cookie check, or even a basic HTTP_REFERRER check.
 

xav0989

Community Public Relation
Community Support
Messages
4,467
Reaction score
95
Points
0
@idontkno
If you know the name of the file, you could still access it, and alv4 doesn't want the directory to be accessed.
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
[...] and alv4 doesn't want the directory to be accessed.

It wasn't entirely clear what exactly the OP wanted, to block all access to the directory (and everything in it), to prevent listing the contents of the directory or something else. So far, everything everyone has posted could be what the OP wanted.
 

quantum1

New Member
Messages
68
Reaction score
0
Points
0
I made a post in the topic http://forums.x10hosting.com/programming-help/97258-help-login-system.html that may help you. It involves using index.php for everything and allows you to put all other data, files, etc. in other directories besides htdocs and its subdirectories so that even Apache can not get to it.

The other method is one mentioned above, to have an empty index.html file. You can still have files in htdocs and subdirectories, but people would have to know the exact url. With an empty index.html file if people just put the url of your site into their browser they will just get an empty screen.
 

alv4

New Member
Messages
321
Reaction score
0
Points
0
You may also consider password protecting the directory. It’s very easy to do from your CPanel > Security > Password Protect Directories

15xo4ds.jpg
I think that this is the best.... but, if i link an image will require password?


@idontkno
If you know the name of the file, you could still access it, and alv4 doesn't want the directory to be accessed.
Noo... I want that I (And everyone) can access to the file... but Not to the directory list...
This is the real example
http://images.habboact.net

Show all the files here... I want to deny access to the list files... but not to the files..
 
Last edited:

gomarc

Member
Messages
516
Reaction score
18
Points
18
... but, if i link an image will require password?

Yes, it will ask you for username and password.

Noo... I want that I (And everyone) can access to the file... but Not to the directory list...
This is the real example
http://images.habboact.net

Show all the files here... I want to deny access to the list files... but not to the files..

Then, why not try idontkno suggestion?

Couldn't you just put a blank index.html file?
 
Last edited:

xav0989

Community Public Relation
Community Support
Messages
4,467
Reaction score
95
Points
0
@blueforpink
You are not entitled to post to a topic just for the sake of it. This is called off-topic, or even spam. There is a category for that purpose here at x10. So if you don't want to add useful information to a topic, please refrain from posting.
 
Last edited:
Top