Reputation: 359
I don't want to show my images, zip files or any other files. Because all of these very important files.
Suppose my image url like it
http://www.example.com/users/upload/images/example.jpg
And if anyone can take below url and go with browser url then they can see my all other images.
http://www.example.com/users/upload/images/
I don't want to show my images files, Or i want to show some 404 page not found.
Can anyone know the solution of above problem?
Upvotes: 3
Views: 3139
Reputation: 2957
In addition to adding Options -Indexes
to your htaccess file, add a/an index.html or index.php inside any directories whose structure you are trying to protect. That way when the user navigates to them, rather than seeing the directory structure, they'll just get served the index file. The index file does not need to contain any code or text.
Upvotes: 0
Reputation: 3702
You can create a .htaccess
file for the folder(images), which should have denied access with
Deny from all
or you can redirect to a custom 404 page
Redirect /images/ 404.html
For more information,
http://www.sitepoint.com/htaccess-for-all/
Upvotes: 2
Reputation: 11
Try this in your apache config file:
<Location />
Options -Indexes
</Location>
Upvotes: 1
Reputation: 5166
you can put a .htaccess file in that folder that contains just:
deny from all
That way you cannot open any file from that folder by url, but you can include them in php without any problems.
Upvotes: 0
Reputation: 120
You can use .htaccess to do that.
I guess Options -Indexes
to your htaccess will do the trick.
Upvotes: 0