# Redirect Back to parent page

**URL:** <https://discourse.slimframework.com/t/redirect-back-to-parent-page/449>\
**Category:** Questions\
**Created:** [June 28, 2016, 11:09am UTC](https://discourse.slimframework.com/t/redirect-back-to-parent-page/449 "2016-06-28T11:09:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pre](https://avatars.discourse-cdn.com/v4/letter/p/ba8739/32.png) [@pre](https://discourse.slimframework.com/u/pre)\
**Post date:** [June 28, 2016, 11:09am UTC](https://discourse.slimframework.com/t/redirect-back-to-parent-page/449/1 "2016-06-28T11:09:09Z")

</div>

hi,

I reuse (include) a twig view (statuses.twig) on two different pages; timeline.twig (url is “localhost/coolsite/public/timeline/”) and profile.twig (“localhost/coolsite/public/profile/josh”).The statuses.twig view has a form which allows the user to reply to a status. the action of the form points to lets say “localhost/coolsite/public/status/4/reply/” After the user click the reply button, I will like it to redirect to the same page (either the timeline or the profile page depending on which page it is currently on). However, I’m experiencing that it is redirecting to the url of the form and not to the url of the page that the form is within.

I use the following:

`return $response->withRedirect((string)$request->getUri());`

but it only returns the url of the form and not the parent page the form is in.

thanks.

---

<div class="post-metadata">

**Author:** ![pre](https://avatars.discourse-cdn.com/v4/letter/p/ba8739/32.png) [@pre](https://discourse.slimframework.com/u/pre)\
**Post date:** [July 16, 2016, 5:34am UTC](https://discourse.slimframework.com/t/redirect-back-to-parent-page/449/2 "2016-07-16T05:34:52Z")

</div>

is there not one who could help?

---

<div class="post-metadata">

**Author:** ![SlimStorm](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@SlimStorm](https://discourse.slimframework.com/u/SlimStorm)\
**Post date:** [July 17, 2016, 7:56pm UTC](https://discourse.slimframework.com/t/redirect-back-to-parent-page/449/3 "2016-07-17T19:56:19Z")

</div>

You can redirect to a string like: “location:javascript://history.go(-1)” or whatever nr you want to go back to.
