I'm trying to 301 redirect old links to new one, the structure of old link is: http://www.example.com/used/details360?rule=11406
The new one should look like this:
http://www.example.com/cars/{make}/{model}/(rule number from the old link)
Problem
I need to use rule number from the incoming old link to call GET API, so I can generate make and model, build a link with that information and 301 redirect to the new one.
And also if the link is dead (404) then it needs to redirect to http://www.example.com/cars
Is that possible?