moved archive redirect stuff to a function instead of a plugin