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
- Notify users only on post publish
- Warning message (re. php) on the blog page
- Started getting warning message following host’s PHP upgrade
- Site throws 500 error after upgrading from PHP 5.6 to 7.X
- How to set up a If is_singular statement?
- Where does “rel=0” get removed from my YouTube parameters?
- List taxonomy term slugs within shortcode (do_shortcode)
- Add content after the first post in WP Loop
- Custom array from a query only write the last row of the query
- Find a way to retrive data updated through metabox plugin to web page
- wp_query get the 2nd post
- How to parse multiple links from one variable?
- What is the latest WordPress that will work on PHP 5.2.17?
- get taxonomy thumbnail and use it as a variable in code
- What are the advantages/disadvantages of using jQuery DOM manipulation as opposed to PHP DOM manipulation?
- update_post_meta on multi-dimensional array options
- How to hook code to show after the_content?
- Why doesn’t add_filter have the option to include a callback for each run?
- Issue with php version 7.2 in running search
- Sending a custom form data in email through WP Mail Function
- Woocommerce Email attachments not working – file not being attached
- Counting Search results, and displaying the offset per page
- Run a code only on theme activation only during first activation