Use referer to fix paths

Use the first 2 segments of the referer url to figure out where the resources should be loaded from, and redirect with a 302