I was hoping to find some useful tips here I could use myself to improve what I already have, but no such luck. Ah well.
I can however provide my own basic tips though on how I did something similar.
For the URL’s, I used a “Slug” text field in my content type (you’ll find that as a display option for the single line textbox field type). These are auto generated from the entry title, but can be overwritten too, and look something like “my-nice-url”. Then in your code you can query based on the slug value, grab the first entry in the array (unless you specifically need 2nd, 3rd, etc) then boom, you got it.
As for 301, 302, 410, etc, that’s a little trickier since Contentful only has statuses Published, Draft, or Archived. Which to me is 200, 404, and ??? (whatever you want). Due to the way we were handling fetching entries I had to do quite a bit of reworking to allow querying of archived items, but basically I now consider anything that is archived to be a 410. You could do something similar for 301, but then you’d have to programatically control where the redirect goes to, which you may not be able to do easily. So it might be easier to have perhaps 2 fields on your content type, redirect type (permanent/temporary) and a link to the new item, or url, or whatever. Then in your code you can determine what to do if these values are populated. (Most like either query Contentful again to get the values from the ID of the linked item, and deliver the appropriate status code to the user, or just redirect if your value is a URL string.)
It can be quite annoying though if you want lots of different content types to be “redirectable”, which is fine for us since we only have 1 content type for now, but it’s still annoying, but unfortunately I couldn’t find a better way to handle it unless the Contentful team add a redirect link into their end which you could then set and query.
Hope this at least gives you some ideas to try out 