Hi team how do I disable my wordpress site directory from accessing? example url: http://mysite.ph/wp-content/uploads/2017/07/Orders-Export-2017-July-04-1712.csv.txt


If you are doing it for security purpose you can use following steps: add index.php file to each folder that you don't want to show the content of.

<?php // Just leave the index.php file blank

And second way to reduce insecurity is to use

if(!defined('ABSPATH')){ exit; }

inside every php files to no access that file directly. I hope it helps. And you are welcome to explore further on your own. Good Luck!!!

  • this protect only PHP files. in addition of this, you can deny access of a whole directory on Apache with a file .htaccess containing Deny from All. – mmm Jan 12 '18 at 8:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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