Reputation: 775
I have a wordpress site running, and currently anyone can view the uploads directory by visiting
http://site.com/wp-content/uploads
I want to stop this directory from being viewed in a browser but I want a subfolder to be viewable (eg. http://site.com/wp-content/uploads/PublicUploads
). I have tried setting
IndexIgnore *
in the uploads folder, but I cannot work out how to set the sub folder back to visible.
Any help would be appreciated
Upvotes: 1
Views: 425
Reputation: 785276
Using mod_rewrite you can block direct access to wp-content/uploads
directory like this:
RewriteRule ^wp-content/uploads/?$ - [F,NC]
Keep in mind that this will only block browsing of /wp-content/uploads
contents but will allow /wp-content/uploads/PublicUploads
or any /wp-content/uploads/foo
.
Upvotes: 0
Reputation: 16825
Most people use
Options -indexes
To make a subdirectory visible again, you'll need to put a .htaccess file inside that subdir, with Options +indexes
inside it.
Upvotes: 2