I don’t know if that is the right way but the last time I worked with IIS, I used this code to prevent the loading of an PHP script in the uploads folder.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<location path="wp-content/uploads">
<system.webServer>
<security>
<requestFiltering>
<fileExtensions>
<add fileExtension=".php" allowed="false" />
</fileExtensions>
</requestFiltering>
</security>
</system.webServer>
</location>
</configuration>
If you try to execute a PHP script in uploads folder or in the subfolders it will result in an 404 Error.
I hope it helps you further.
Usefull Links to that subject:
Translate .htaccess Content to IIS web.config – docs.microsoft.com
Related Posts:
- esc_attr() right way and use
- Enforcing password complexity
- Is it safe to use $_SERVER[‘REQUEST_URI’]?
- Does My Child-Theme Functions.php Need if{die} Security In It? [duplicate]
- How Attackers write script into my php files?
- Renaming wp-content folder dynamically
- How do I create a WP user outside of WordPress and auto login?
- Installing wp3.2.1 on IIS; getting empty sessions
- Trigger a php file on every post or page if a condition is met
- Security – Ajax and Nonce use [closed]
- Can I write ‘RewriteCond’ using ‘functions.php’?
- Is it unsafe to put php in the /wp-content/uploads directory?
- Best way to create a user programatically
- Sanitize get_query_var() url parameters
- Javascript code inside “” in core WordPress files .php
- When must I use and verify nonce?
- wordpress upgrade has broken my permalinks
- Hiding WordPress Plugin Source Code
- Is this code malidcous
- Loading jQuery in the footer after removing jQuery migrate?
- Writing scripts using WordPress / WooCommerce classes?
- Admin username and password
- Evaluations of two wordpress security plans against php code injection attack
- Insert a button on a page with random number generation
- WordPress custom login form using Ajax
- Where Does WordPress Make cURL Requests? How To Add cURL Option
- Detect session/cookie variable in wordpress to prevent access to documents
- Is there any risk setting WordPress file permissions and FS method to ‘direct’ on localhost?
- SQL Injection blocked by firewall
- How to prevent XSS alter custom global javascript object & methods in WordPress
- Repeating admin-ajax.php not found error in admin
- Generating an nonce for Content Security Policy and all scripts – How to make it match/persist for each page load?
- Cannot execute php files in wp-content
- How do I get around “Sorry, this file type is not permitted for security reasons”?
- Configure Php server with ISAP
- php syntax : [ && ] between commands [closed]
- Security: blocking direct access of php files
- Correct and safe way to include php content in my page
- Custom PHP script throws critical error ONLY when editing page
- Password minimum length in personal subscription [closed]
- Need to put a script above tag in header.php – WP 5.7.1
- How to add API security keys into JS of wordpress securely
- Is it best to avoid using $wpdb for security issues?
- Troll the hackers by redirecting them
- Security updates to 3.3.2
- how to prevent wordpress admin from logging in via woocommerce my-account page
- malware undetectable by multiple scans
- Decoded malware code [closed]
- How can I get my Media Uploader Button to function on 1 click rather than requiring 2 clicks?
- Updating From Mobile App – Exposing Site to Hacking
- security concerns if using html data-* attribute for l10n?
- How to correctly escape an echo
- Reject all malicious URL requests functions.php
- portfolio site – about this site section – is it safe to post some code
- echo cutom css code to WordPress page template file ? is this safe?
- How to secure my php forms
- $.ajax results in 403 forbidden
- How to add a PHP scripts into WordPress
- Suddenly got alert when trying to login to admin panel of wordpress
- Site infected by link
- How do I add this OnClick event script to a custom button I’ve created?
- Unable to update plug-ins – Undefined index a:1:{s:3:”ssl”;b:1;} in class-requests.php on line 213
- Access WP files on “server 1”, from “server 2” – using wp-load on an external website
- Deny php execution in /wp-includes – using .htaccess in /wp-includes VS root folder
- Add Custom Taxonomy into Script
- how to call other plugins once custom post has been inserted
- style.min.css code issue
- Retrieve $_POST data to send to javascript without using localize script
- Previewing/Updating some Pages causes “The requested URL was rejected” Error
- What is the best practice for restricting a section to logged in users?
- Editing existing pre-created menus in PHP
- Manipulate database of WordPress site with my own scripts
- Auto create description in post
- How to quickly/easily make an analysis (reverse engineering) of WordPress?
- kali php problem [closed]
- what to do after instlling cyberpanel on VPS
- Running a long script in PHP
- append PHP function to the_content
- How to track a users progress through pages by inserting data into WordPress Database?
- Block PHP Files Nginx
- WordPress File handle – fopen, fwrite not working with $.ajax or $.post Jquery
- How does the ternary operator work in the wordpress loop post?
- Advanced Meta Query for Large Calendar Website (12k+ posts) (175k+ wp_postmeta rows)
- How to store post ID’s in cookie or session to display the same posts later
- Whats the proper way to use a php stylesheet in a wordpress theme? [duplicate]
- Change product_base programmatically
- Adding “redirect” to a button
- Execute Jquery when a specific page in my plugin is loading
- Validating an email input from form field before submit using JQuery, AJAX, and PHP
- Display metabox galleries on specific page template in admin editor
- Inside Array – “unidentified index” error with “prepare was called incorrectly” despite not calling the prepared statement with wordpress [closed]
- dashboard widget form not submit mails
- If is_page elseif is_page not working like I want it to
- Updating meta_value in a custom key
- Where to find the html for WordPress site? [closed]
- Custom post type single page return to listing page
- Using Nonce for my Form
- Transient Loop Not working as expected
- Open all external links in new window – need help with the code
- HTML in PHP problem [closed]