How to restrict access to wp-content, wp-includes and all sub-folders

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. 🙂