# Call Route from other Route

**URL:** <https://discourse.slimframework.com/t/call-route-from-other-route/179>\
**Category:** Questions\
**Created:** [April 26, 2016, 3:16pm UTC](https://discourse.slimframework.com/t/call-route-from-other-route/179 "2016-04-26T15:16:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Knate](https://avatars.discourse-cdn.com/v4/letter/k/b77776/32.png) [@Knate](https://discourse.slimframework.com/u/Knate)\
**Post date:** [April 26, 2016, 3:16pm UTC](https://discourse.slimframework.com/t/call-route-from-other-route/179/1 "2016-04-26T15:16:53Z")

</div>

I have a question based on the routing with slim.

I have to routes.

Route 1:  
/login

Route 2:  
/stats

When a user want to get stats, a login is need first. But i don’t want to implement the login twice.  
So my idea is, if a user called the /stats route, the /login route is called internal first.

But how can i redirect from /stats to /login?

Or should i implement the logic in a seperate method and call this method in /login and in /stats?

---

<div class="post-metadata">

**Author:** ![tflight](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/tflight/32/1205_2.png) [@tflight](https://discourse.slimframework.com/u/tflight)\
**Post date:** [April 26, 2016, 3:34pm UTC](https://discourse.slimframework.com/t/call-route-from-other-route/179/2 "2016-04-26T15:34:19Z")

</div>

This would typically be handled is through an authentication/authorization middleware. When a user attempts to go to /stats, the middleware gets called. If the user has logged in they will be sent along to /stats. However if the user is not logged in, the middleware will redirect the user to the /login page.
