JackD's avatar

Photo Directory

Hi, I recently followed the Build Project Flyer here and I made my own version of it while following but I wonder how can I make the photo directory which is inside the Public folder not available when they access the image url directory (http://projectURL.com/images). Because when I access the image url directory it displays all the uploaded photos of users in directory folder.

I moved it inside the Storage folder but still the same problem the users can access the image url directory folder

0 likes
8 replies
d3xt3r's avatar

Add the below to your .htaccess

Options -Indexes
JackD's avatar

@premsaurav I dont have .htaccess inside storage folder but I have in my public folder

d3xt3r's avatar

I know, and i meant to add it there (htaccess in public folder, it prevents directory listing), and why/how is your storage folder accessible from web ?

JackD's avatar

@premsaurav it works after adding "Options -Indexes" into my .htaccess but is there other way to show my 404 page instead of plain "Access forbidden!" ?

d3xt3r's avatar

Couple of options

  1. Look at htaccess ErrorDocument
  2. have an index.php in your images directory and redirect it your 404 page.
orj's avatar

@premsaurav I add

ErrorDocument 403 /

at the bottom of my .htaccess but it displays the 404 page instead of my 403 page

JackD's avatar

@premsaurav I already tried, still redirects me to my custom 404 not to my custom 403 page

Please or to participate in this conversation.