# Route not working in one specific situation

**URL:** <https://discourse.slimframework.com/t/route-not-working-in-one-specific-situation/3797>\
**Category:** Questions\
**Created:** [January 16, 2020, 8:01am UTC](https://discourse.slimframework.com/t/route-not-working-in-one-specific-situation/3797 "2020-01-16T08:01:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![EKoster](https://avatars.discourse-cdn.com/v4/letter/e/67e7ee/32.png) [@EKoster](https://discourse.slimframework.com/u/EKoster)\
**Post date:** [January 16, 2020, 8:01am UTC](https://discourse.slimframework.com/t/route-not-working-in-one-specific-situation/3797/1 "2020-01-16T08:01:23Z")

</div>

Hi all. I added a route to my `routes.php` to handle a translation button. Two buttons go to the route `funcToggleLanguage` with the `strLanguage` parameters. When clicked it will reload the same page but with a newly set language.

The thing is, if I am on the root url, then this doesn’t work. In stead it seems to loop

```
use Slim\App;
return function (App $app) {    
    $app->get('/', \App\Action\Home\HomeAction::class)->setName('root');
    $app->get('/challenges', \App\Action\Challenge\ChallengeAction::class)->setName('challenges');
    $app->get('/ventures', \App\Action\Venture\VentureAction::class)->setName('ventures');
    $app->get('/{strLanguage}', function ($oRequest, $oResponse, $oArguments) {
        if ($oArguments['strLanguage'] === 'nl') {
            $_SESSION['strLocale'] = 'nl_NL';
        }
        if ($oArguments['strLanguage'] === 'en') {
            $_SESSION['strLocale'] = 'en_US';
        }
        return $oResponse->withRedirect($_SESSION['strRouteFrom'], 302);     
    })->setName('funcToggleLanguage');
};
```

---

<div class="post-metadata">

**Author:** ![odan](https://avatars.discourse-cdn.com/v4/letter/o/9de053/32.png) [@odan](https://discourse.slimframework.com/u/odan)\
**Post date:** [January 16, 2020, 8:57am UTC](https://discourse.slimframework.com/t/route-not-working-in-one-specific-situation/3797/2 "2020-01-16T08:57:38Z")

</div>

That seems suspicious to me:

> [@EKoster](#):
>
> $\_SESSION[‘strRouteFrom’]

---

<div class="post-metadata">

**Author:** ![EKoster](https://avatars.discourse-cdn.com/v4/letter/e/67e7ee/32.png) [@EKoster](https://discourse.slimframework.com/u/EKoster)\
**Post date:** [January 16, 2020, 11:38am UTC](https://discourse.slimframework.com/t/route-not-working-in-one-specific-situation/3797/3 "2020-01-16T11:38:25Z")

</div>

I was thinking about it, and replaced it with ‘root’ instead to make sure just a while ago. It gives the same result though. But it could be something related. I’ll do some debugging on it later on.
