Disable WordPress Directory Browsing With Your Apache .htaccess File

This code snippet will disable WordPress directory browsing and stop people from seeing your directory contents directly.

In a default WordPress installation people can browse your core directories and see the file contents by pointing there browser at; (for example)

http://www.yourdomain.com/wp-content/uploads/

This may be handy for you as a developer, but do you really want people browsing your images and other files?

Disable WordPress Directory Browsing

Prevent this from happening by placing the following snippet into your .htaccess file in the root of your WordPress installation.

######## begin prevent directory browsing ########
Options All -Indexes
######## end prevent directory browsing ########

Now when people try to snoop your directory they will see the following;

http://advent.squareonemd.co.uk/wp-content/uploads/

Enjoy.

About

Solutions Architect, IT specialist, Open Source enthusiast and fan of all things web and internet. Does not work at Starbucks or sell mufflers. Feel free to get in touch.

Leave a Reply

Your email address will not be published. Required fields are marked *