WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

after searching I didn't find an answer still confused of how do I hide the
-> wp-content
--> uploads
--> themes
--> plugins
-> wp-includes in browser. What I want is when viewer browse some like this: http://www.mysite.ext/wp-content they will see an error: You don't have permission to access this page.
Other said that just upload index.html or index.php with .htaccess in the folder you want to hide. But what if I have many subfolder inside wp-content I will do that every folder manually? Or there is a way either in cpanel, or in .htaccess ? Suggestion please, thanks.

share|improve this question
up vote 1 down vote accepted

Use in your .htaccess:

Options -Indexes

… to disable directory listings. See the Apache manual for details.

To restrict the access just to two URLs you might use:

RedirectMatch 204 ^/wp-content/$
RedirectMatch 204 ^/wp-content/dir/$

204 is the No Content response. Very fast. :)

share|improve this answer
:) I got an internal server error when I use the <Directory /wp-content/>Options -Indexes</Directory>, I place that in root .htaccess and wp-content folder has index.html. – jho1086 Nov 13 '12 at 10:28
Of course you did. Directory is not allowed in a .htaccess. Just use this one line I posted, unless you need directory listings in a child directory. – toscho Nov 13 '12 at 10:37
oh, my apology. The Options -Indexes didn't do something like this: prevents access to any URL-path that begins in /wp-content. In particular, it will apply to requests for mysite.ext/wp-content, mysite.ext/wp-content123, and mysite.ext/wp-content/dir/file.html as well as any other requests starting with the /wp-content string. – jho1086 Nov 13 '12 at 11:33
So you want to disallow requests to your stylesheets, theme images, plugin files, the media library and other uploads? Why? – toscho Nov 13 '12 at 11:39
no, only the mysite.ext/wp-content and mysite.ext/wp-content/dir. :) – jho1086 Nov 13 '12 at 11:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.