I am using WordPress, I have to hide WP-includes, and WP-content/uploads from WordPress. I have tried to add the below code in htaccess
Options -Indexes
Also, I have referred to this link but still, it’s not working for me.
The below link is working
http://localhost:8080/wordpress/wp-includes/
but if I add then I can see all the files. Same for the upload folder
http://localhost:8080/wordpress/wp-includes/assets
http://localhost:8080/wordpress/wp-content/uploads/2022/01
Note-localhost is just an example
2
Answers
After some research, I have created a
.htaccess
file in thewp-content/uploads
and added the below code. And it's started workingWhere does the
.htaccess
file exist on the server? Which path?Are you sure your web server is processing this file? Are you indeed running Apache?
As long as you have a file named
.htaccess
(no spaces), and it’s placed in your root HTML folder, or within bothwp-includes
andwp-content
folders, and somewhere within the file on its own line, you haveOptions -indexes
, this should be respected for all subfolders and turn off auto-indexing. Can you share the entire contents of this file, perhaps you have placed this line somewhere it’s not being read.