Fixing template links to redirect properly