I open this issue because I had the same issue on 6.x GR and now it is quite the same.

So, I have a multilingual website uses prefixes, multi-site configuration, image module.

The problem appears when image style file is not exists and needs to be generated.

When image requested, i.e. http://www.example.com/sites/example.com/files/styles/thumb/image.jpg

GR module redirects request with 301 to http://www.example.com/PREFIX/sites/example.com/files/styles/thumb/image...

where PREFIX is default language and set not empty, i.e 'en'.

When browser trying to open the following URL then receives 404 error:

http://www.example.com/PREFIX/sites/example.com/files/styles/thumb/image...

So, I'd like to let the module to generate an image from the URL such as:

http://www.example.com/sites/example.com/files/styles/thumb/image.jpg

My apologies if this issue already have a solution or a patch but I was not able to find a solution after a deep digging.

Thanks in advance!

Comments

spanac’s picture

Try this:

in: /admin/config/system/globalredirect

enable: Language Path Checking

UPDATE: this will not work. Sorry.

irowboat’s picture

Anyone figured this out? My image urls are being rewritten.

fox_01’s picture

I have switched to language subdomain path and this will also work with image urls

irowboat’s picture

Yeah, dropping language from the url does the trick. Provided you have the option.

jeisses’s picture

This is an issue for me as well, but I can't drop the language from the URL..

Is there an other way to get image styles to work with GR on a multi-language site?

----
Edit:

Never mind, it turned out I had an Nginx configuration issue, I don't have problems with this anymore

zviryatko’s picture

Never mind, it turned out I had an Nginx configuration issue, I don't have problems with this anymore

Also meet this problem, if you have official drupal-nginx config, don't forget to change this rule:

location ~ ^/sites/.*/files/styles/ {
    try_files $uri @rewrite;
}

to location ~ .*/sites/.*/files/styles/ {

sjerdo’s picture

Title: GR and images on multilingual site (language prefix) » Image styles on multilingual site with language prefix not found
Category: Support request » Bug report
Priority: Normal » Major

Still experiencing this issue while using a nginx-configuration.
Changed the category to Bug report, since this breaks image styles (picture module) when a prefix is set in a multilingual setup.

The Global redirect module should not redirect for these files. This allows for duplicate content (eg. file1 is accessible at /en/sites/default/files/file1 and /nl/sites/default/files/file1)

fjgarlin’s picture

Status: Active » Needs review
StatusFileSize
new1.27 KB

I was facing this issue as well and could not find any option to bypass the default language fallback for files. I created a patch that:

  • Adds a new option in the admin screen called "Ignore Public Files Path".
  • When the above option is ticked, if the request is for a file, it will ensure that the prefix is empty.

In my case this seemed to do the trick. I hope it helps.

rodrigoaguilera’s picture

I found the patch on #8 not to work for me.
Why not just return and avoid any redirect for files?