问题
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?
回答1:
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/
回答2:
Try this in your apache config file:
<Location />
Options -Indexes
</Location>
回答3:
You can use .htaccess to do that.
I guess Options -Indexes to your htaccess will do the trick.
回答4:
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.
回答5:
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.
来源:https://stackoverflow.com/questions/29229811/dont-want-to-show-my-folder-file-structure-from-browser-url