0

I'm using Silex and I'm trying to redirect from one to another route, but with changing URL. I've tried a few things so far.

1) Using Sub-Request, works but URL does not change.

2) Using Normal redirect works but the data is sensitive and i don't want to pass it to the client and then back if not needed.

-> $app->redirect($app['url_generator']->generate('route_name', array( 'data' => $dataArray )));

What i actually want is to internally redirect with some data. But the URL has to change.

My Routes look like this:

$app->match('/some/url/', 'Acme\\Controller\::someAction')
    ->bind('route_name');

How to do that in Silex?

And yes i know that Silex is in maintenance mode.

1 Answer 1

1

URL is a client side thing, if you wan't to change it you don't have the choice : you need to go back to client side.

Have you considered to modify the URL after the response ? In javascript, you can modify the URL without reload the page :

https://developer.mozilla.org/en-US/docs/Web/API/History_API

https://stackoverflow.com/a/3354511/3139242

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.