# Re-routing in a server-side rendered application

**URL:** <https://discuss.emberjs.com/t/re-routing-in-a-server-side-rendered-application/9203>\
**Category:** Ember CLI\
**Created:** [November 27, 2015, 4:27pm UTC](https://discuss.emberjs.com/t/re-routing-in-a-server-side-rendered-application/9203 "2015-11-27T16:27:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pyro240](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/pyro240/32/11745_2.png) [@pyro240](https://discuss.emberjs.com/u/pyro240)\
**Post date:** [November 27, 2015, 4:27pm UTC](https://discuss.emberjs.com/t/re-routing-in-a-server-side-rendered-application/9203/1 "2015-11-27T16:27:58Z")

</div>

I [posted this question](http://stackoverflow.com/questions/33945606/how-to-access-a-route-of-an-ember-application-built-with-ember-cli-from-custom-h) on Stack Overflow already but maybe I wrote too much text or something. If this topic does not fit into this forum I apologize.

So I have this legacy web application built with the Yii PHP framework and I want to use Ember to improve functionality, reduce spaghetti JS and to replace multiple server-side rendered CRUD templates by stateful Ember templates and components.

My main concern is that I want to use Ember models and templates while keeping the routing logic in the JS loaded after the Ember application. We have an existing API for a few models that we want Ember to fetch. The pages the user loads have an unusable URL, though, so we have to somehow instruct the Ember app to load the `cars/index` controller on a given page using JS.

Let’s assume we are dealing with a `index.php?r=cars/index` JSON API that will get us all `cars`. And we can fetch `index.php?r=cars/index_html` that will output the list of cars as HTML, and load some assets including our Ember app.

Now, when I visit that page the Ember Inspector shows that I’m on `IndexRoute` but I cannot get `IndexRoute` to redirect to `cars` or `cars/index` so that the cars are actually fetched and the corresponding template is displayed.

What I need is some JS that will allow me to redirect to that controller or maybe you have an alternative way to integrate Ember into this legacy application, keeping all the EmberData functionality and that will not restrict me to using components like ember-islands does. (I could not get that to fetch the models either, and I want to keep templates for each REST action as well.)

---

<div class="post-metadata">

**Author:** ![kicauipul](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/kicauipul/32/11383_2.png) [@kicauipul](https://discuss.emberjs.com/u/kicauipul)\
**Post date:** [November 28, 2015, 11:39am UTC](https://discuss.emberjs.com/t/re-routing-in-a-server-side-rendered-application/9203/2 "2015-11-28T11:39:33Z")

</div>

well, I dont know how to do that, since i dont know your code. But what you need to do is just call `transitionTo` from the current route (in your case is `IndexRoute`). Maybe define an action on `IndexRoute`that call`transitionTo```, anywhere on your code should send an action to fire it, maybe on component.

Basically i dont like the concept of server-side rendered app like that, it’s too complex. My reccommandation is just tell the server side to render preloadData.
