UPLOADS constant not working in WordPress Multisite

admin2025-01-07  3

I have moved the wp-content/uploads folder to the same folder as the wp-content folder and then added define( 'UPLOADS', 'uploads' ); constant in the wp-config.php file.

Now the images are not displaying while I browse the website.

Fyi, My website is a folder-based multisite. For example:

  • https:// domain . com/
  • https:// domain . com/en/
  • https:// domain . com/bn/

I have moved the wp-content/uploads folder to the same folder as the wp-content folder and then added define( 'UPLOADS', 'uploads' ); constant in the wp-config.php file.

Now the images are not displaying while I browse the website.

Fyi, My website is a folder-based multisite. For example:

  • https:// domain . com/
  • https:// domain . com/en/
  • https:// domain . com/bn/
Share Improve this question asked Dec 31, 2024 at 17:42 Shah AlomShah Alom 4981 gold badge5 silver badges14 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 2

I think that you're saying that you have moved your "uploads" directory up a level such that it now exists within your installation root, alongside /wp-includes, wp-config.php, etc.?

If so, you likely need to update the rewrite rules in your webserver configuration. By default, a multisite .htaccess configuration has a rule like

RewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]

This says "if the URL path begins with /somesite/wp-content/whatever then serve the file located at {ABSPATH}/wp-content/whatever" (and the same for wp-admin and wp-includes).

Because uploads is not factored into this or some other rule, no attempt is made to resolve the path to a file, and instead WordPress will end up processing the request as though that path is a permalink.

Add another rule above or below that line in order to account for your new location:

RewriteRule  ^[_0-9a-zA-Z-]+/(uploads.*) $1 [L]
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736254285a192.html

最新回复(0)