Image Paths with Multiple Languages


We recently moved over to ModX cloud and now when adding images to pages on pages using a different language, it now rewrites the image path to include the language path.

For instance, if we want to load /assets/images/image.png it rewrites it to /de/assets/images/image.png which results in no image being loaded on page.

Step to reproduce

It happens on all of our non-english pages whenever placing images on the German, French, Spanish, Czech, and Italian pages.

Try changing your media source configuration (media > media sources) to have baseUrlRelative disabled and the baseUrl set to a slash (or the actual subdirectory).

Did that already based on another thread. Still forcing to the language so it’s /de/assets/uploads/image.jpg instead of /assets/uploads/image.jpg

Can you check the page source to see if the image URLs actually have the language prefix, or if they’re written out as relative urls that the browser then interprets as relative to the base tag?

Also where/how are the image URLs being set? Are these image TVs, ContentBlocks, content (if so which RTE), MIGX, or any of the above rendered from another resource with get/pdoResources?

Please set the system setting phpthumbof.cache_url to / . Otherwise the generated thumbnail path of the snippet/output filter will contain the {base_url}{cultureKey} prefix, that needs an additional .htaccess rule that removes this prefix.

1 Like