301 redirects automation with custom code

Followup to this thread: