Search code examples
wordpress.htaccess

Hide WP-includes, and WP-content/uploads from WordPress


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


Solution

  • After some research, I have created a .htaccess file in the wp-content/uploads and added the below code. And it's started working

    # Kill PHP Execution
    <Files ~ ".ph(?:p[345]?|t|tml)$">
    deny from all
    </Files>