I have such a query:
/upsell/someextrapath/images/image1.png
This path does not exist. I want to create a rule with htacess, which removes %someextrapath% from the url, so url will be working.
PS: this %someextrapath% can vary from one page to another. This is the main problem.
Try :
RedirectMatch ^/upsell/.+/([^/]+)/(.+)$ /upsell/$1/$2