Redirect for previous on-premises URLs
Closed this issue · 5 comments
Please describe the feature you would like to see implemented.
Once the new URLs have been generated all requests to the former image locations' URLs fail.
An automatic redirect would be good to have.
I don't see a way without flooding the database with urls for redirect.
If you have any idea: PR is welcome :-)
"PR"? 🤷🏻♂️
I was thinking of a pattern matching the thumbnail pattern with the previous URIs.
Query parameters might even be neglected.
But I can see also requests to older image paths, which have been generated prior to the switch.
Did previous versions of the thumbnail generator create new paths with every run? 🤔
The current one, bin/console media:generate-thumbnails
, does not do so.
So, in short it seems three cases to me:
- change from non-processed path to thumbnail-pattern at initial setup,
- changes (in mediaPath) post setup and
- changes in mediaPath prior setup
1 and 2 might be mapped and redirected using the {mediaPath}
part of the URL.
For 3 I can only think of looking up the asset's filename and automatically setting a redirect for the ones identified still in.
But the effort involved does not seem reasonable compared to identifiying and manually mapping each one affected.
Uhh, good catches. I'm not sure if it's worth, but:
PR (Pull Request) is welcome.
A large amount of shop owners will - themselves or by interested customers - post product images to e.g. Pinterest.
When the image link is lost the post might be de-graded or removed.
I will add the catches to our backlog, too.
We decided not to implement this into the plugin, while it will cause the Kernel to boot several times.
Please use your web server to redirect specific requests.
RewriteRule for Apache could look like this:
RewriteRule ^thumbnail/(.*)_\d+x\d+.(.*)$ https://cdn.myshop.com/media/$1.$2 [L,R=301]