I’m trying to make a rule that will block the folder access from browser. For example if the user types https://example.com/images , and there is a folder named images in my root, the user should get forbidden
this are the rules that I currently have:
rewrite / {
r .*
ext / #to /forbidden
to {path} {path}/ /index.php?{query}
}
The image you’ve shared shows the index listing provided by Caddy’s browse directive.
Remove browse from your Caddyfile and Caddy will stop providing this listing (clients will receive a 404 status if they try to navigate a directory that has no explicit index file).
@Whitestrake thank you for the reply… I thought about that but I couldn’t find the brows directive in my Caddyfile. After your reply, as I wanted to post you the entire content of my Caddyfile, I spotted the brows directive hidden in other lines of code.
As you mention, as soon as i commented the brows directive, I achieved what I desired. Thank You!