WordPress disable directory browsing is a must for security. Prevent visitors from viewing your folders directly with this quick .htaccess tweak — no plugin needed!
Add this to the bottom of your .htaccess
file:
# Disable directory browsing
Options -Indexes
How It Works
This WordPress disable directory browsing tweak tells the server to block directory listings. If someone tries to open a folder with no index file, they’ll see a 403 Forbidden instead.
Why WordPress Disable Directory Browsing?
Leaving directory browsing enabled can expose sensitive files or structure details. Disabling it keeps curious visitors or bots out of your folders.
Common Mistake
Always back up your .htaccess before edits. And test your site to make sure nothing breaks — this tweak is safe but typos can cause errors.
Pro Tip
Combine this with strong file permissions for an extra layer of protection.