This website uses cookies to allow us to see how the site is used. If you continue to use this site, we assume that you are okay with this. If you want to use the sites without cookies, please see our privacy policy.

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;

https://advent.elliottrichmond.co.uk/wp-content/uploads/

Enjoy.