Multisite image URLs incorrect in editor
I’ve been driving myself nuts with this one, so I’m hoping someone might be able to help.
I have a Multisite with the latest WordPress version set to subfolders. The issue I am experiencing is with images in the post editor – I am using a vanilla block editor off the shelf.
Let’s say I have the setup below, where each is its own blog within the network.
example.com
example.com/product-a/
example.com/product-b/
When a user uploads an image to the Product B blog (as an example), in the file system it is properly saves to example.com/wp-content/uploads/sites/03/2022/09/someimage.jpg
. If I go to this URL then the image is visible, and when I publish a post it works with no issue.
However, in the post editor I get broken image placeholders. When I inspect it in Chrome, the broken editor image points to example.com/product-b/wp-content/uploads/sites/04/2022/09/someimage.jpg
.
Everything I’ve read has had me looking at the .htaccess
file, but for the life of me I can’t figure out what’s wrong. Here’s my .htaccess:
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
Any help would be great – thank you in advance!
Leave an answer