What is the Best .Htaccess to use to avoid accessing mysite.com/folder

0 Raji Rajah · July 9, 2015
What is the Best .Htaccess to use to avoid accessing mysite.com/image folder that will display my images on mysite and my hosting site will not show error.

Post a Reply

Replies

Oldest  Newest  Rating
0 Mitch Mullvain · July 11, 2015
Options All -Indexes

That's it. Name it .htaccess and stick it into your Images folder. That will give it a 403 error which means that the user can't access it. It will allow them to access a specific file though.

Not Viewable:
example.com/image


Viewable:
example.com/image/Image1.jpg
0 Raji Rajah · July 12, 2015
Have tried,it worked it but the images are not showing like my logo and icons
0 Mitch Mullvain · July 14, 2015
Couple things: 


If you are wanting images to stay indexed (meaning every file is shown at example.com/image), then you don't need a .htaccess, or at least you don't need to remove indexes. I have a server and in my images .htaccess I have
Options -Indexes

and I don't have a problem. Images load, but a 403 is given when I enter the image directory and don't specify an image.

Maybe it is your server configuration. Talk to your hosting provider about it if none of the solutions work.
  • 1

PHP

107,180 followers
About

Server-side, HTML embedded scripting language used to create dynamic Web pages.

Links
Moderators