Why can I not use modrewrite on the /wp-content/uploads directory?

Ruth Turner
Published: 31 October 2023Last updated: 14 March 2024
Share:

The error rewrites_uploads_blocked refers to a security rule implemented into our system to protect WordPress sites on our platform – it prevents mod_rewrite rules from working from within your uploads directory, which is a common target for malware and attacks.

This rule is built into our shared hosting platform, and as such is not possible to disable. Should you need to have content within your uploads folder make use of mod_rewrite rules, you’ll need to either change the upload directory within your WordPress install, or move the site to our Managed Cloud Hosting, and request to our support team via ticket we remove the rule on your setup.

How do I change the uploads directory on my WordPress site?

Should you wish to take the option to change your WordPress site’s uploads directory, you’ll need to do the following:

  1. Access your site via the File Manager within My20i, or use FTP to connect to your site following this guide.
  2. Navigate to wp-content, and create a new folder with the name you want to use for your new Uploads folder.
  3. Navigate to your wp-config.php file and open it.
  4. Scroll down until you see the line:

/* Add any custom values between this line and the "stop editing" line. */

And beneath that, add the following:

define('UPLOADS', 'wp-content/yourfoldername');

Replacing yourfoldername with the name of the folder you created.

Once done, save the file and close it.

This will change your uploads folder globally, and newly uploaded files will be stored within this directory instead.

Note: Previously uploaded files will not be moved automatically – you will need to move any pre-existing files in your uploads folder to the new folder you created.