Patch old redirect code into main file