This one may have been answered but I can't seem to find one that fits my specifics. So apologies if it sounds old.
My rewrite consists of using a rewrite map and a redirect to another domain.
For example:
An old site has moved and new id's have been generated along with file name changes
So this URL:
https://www.example.com/gallery/951/med_U951I1424251158.SEQ.0.jpg
would need to be redirected to
https://www.example2.com/gallery/5710/med_U5710I1424251158.SEQ.0.jpg
The new value 5710 comes from a rewrite map lookup where I pass 951
there are two changes needed and the 2nd change has two possible variations:
The first change is
gallery/951togallery/5710The 2nd change is the filename where the id can be delimited in either of 2 ways:
U951I- delimited between aUand anI
or
U951.- delimited between aUand a.
I started with something like this:
RewriteRule "^gallery/(\d+)/(\s+)$"
But that is as far as I can get.