Title: Disable Code Execution for Uploads directory Not Working
Last modified: December 13, 2020

---

# Disable Code Execution for Uploads directory Not Working

 *  Resolved [sahuaro007](https://wordpress.org/support/users/sahuaro007/)
 * (@sahuaro007)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/disable-code-execution-for-uploads-directory-not-working-2/)
 * I’ve enabled this option and I see the htaccess file is in the uploads folder.
   Also, I just manually put a Hola.PHP file in there and it works when viewing 
   it in a browser. How do I get this to work properly? I’m running PHP Version 
   7.2 on a VPS with cPanel.
 * ************ .htacces code: **************
    # BEGIN Wordfence code execution 
   protection <IfModule mod_php5.c> php_flag engine 0 </IfModule> <IfModule mod_php7.
   c> php_flag engine 0 </IfModule>
 * AddHandler cgi-script .php .phtml .php3 .pl .py .jsp .asp .htm .shtml .sh .cgi
   
   Options -ExecCGI # END Wordfence code execution protection **************************************************
 * *********** Hola.php code ********************
    <?php echo “The time is ” . date(“
   h:i:sa”); ?> **********************************************
 * Thanks for your help!

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Support [WFAdam](https://wordpress.org/support/users/wfadam/)
 * (@wfadam)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/disable-code-execution-for-uploads-directory-not-working-2/#post-13787025)
 * Hello [@sahuaro007](https://wordpress.org/support/users/sahuaro007/) and thanks
   for reaching out to us!
 * In the `htaccess` file within the uploads directory, add this code to it:
 *     ```
       <Files *.php>
       deny from all
       </Files>
       ```
   
 * Let me know if this helps!
 * Thanks!
 *  Thread Starter [sahuaro007](https://wordpress.org/support/users/sahuaro007/)
 * (@sahuaro007)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/disable-code-execution-for-uploads-directory-not-working-2/#post-13794374)
 * Hi Adam,
 * Yes, it works!
 * thanks for youe help!
 *  Plugin Support [WFAdam](https://wordpress.org/support/users/wfadam/)
 * (@wfadam)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/disable-code-execution-for-uploads-directory-not-working-2/#post-13797290)
 * Great success!
 * Let us know if you need anything else!
 * Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Disable Code Execution for Uploads directory Not Working’ is closed to
new replies.

 * ![](https://ps.w.org/wordfence/assets/icon.svg?rev=2070865)
 * [Wordfence Security - Firewall, Malware Scan, and Login Security](https://wordpress.org/plugins/wordfence/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordfence/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordfence/)
 * [Active Topics](https://wordpress.org/support/plugin/wordfence/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordfence/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordfence/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [WFAdam](https://wordpress.org/support/users/wfadam/)
 * Last activity: [5 years, 6 months ago](https://wordpress.org/support/topic/disable-code-execution-for-uploads-directory-not-working-2/#post-13797290)
 * Status: resolved