🛡️ Access Shield Pro v1.2 released - Now with Spamhaus & Emerging Threats feeds
🤖 AI Support Assistant 2.1 - GPT-5 & Claude Opus 4.1 support, auto-signatures, improved error handling.
🧮 Recalculate Prices v1.2 - Fixed addon pricing, enhanced safety checks, full billing cycle support.
🔧 PowerDNS Manager v1.11 - Enhanced logging security with better data sanitization, improved debug output handling, bug fixes.

Disable Directory Browsing with .htaccess Print

  • 0

Stop Apache from showing directory contents when no index file exists.

Disable Directory Browsing

Add to .htaccess:

Options -Indexes

That's it.

What This Prevents

Without this, visiting example.com/uploads/ shows:

Index of /uploads
[ICO] Name            Last modified      Size
[DIR] 2024/           2024-01-15 10:23    -
[IMG] secret.jpg      2024-01-12 09:15   2.1M
[TXT] passwords.txt   2024-01-10 14:22   1.2K

With this, visitors get:

403 Forbidden

Variations

Disable for specific directories:

<Directory /var/www/html/uploads>
    Options -Indexes
</Directory>

Custom error message:

Options -Indexes
ErrorDocument 403 "Access denied"

Hide only certain files:

IndexIgnore *.pdf *.doc *.zip

Enable for Specific Folders

If you need directory listing somewhere:

# In specific folder's .htaccess
Options +Indexes

Check Current Status

curl -I https://example.com/uploads/

Returns 403 = disabled, 200 = enabled


Was this answer helpful?

« Back

WHOIS Information

×
Loading WHOIS information...