core: set the zotonic_dispatch_path to the path before an internal resource redirec.

(cherry picked from commit 9a4e601ebb8c5f562ece6bcc455d4324dd2985d4)