I have a route set up in routes.php that calls a controller action using something similar to what is described here: https://straightupcraft.com/articles/how-do-i-setup-a-route-to-point-to-a-controller-action-instead-of-a-template
This works much better for my purposes than POSTing a form to the controller. However, I'm not sure how best to handle redirects. Ideally I would like to redirect back to the page where the user clicked on the link, but calling
$this->redirectToPostedUrl()
doesn't work when using a route like this. The URL just remains the URL as defined in the route.
Is there a different method I can use to make sure users are returned to the page where they were when they clicked the link?