I have set a redirect rule in EventSubscriber. So according to rule, when I hit [example.com/my-page][1] in browser, it should redirect to [example.com/success][1] or some external url also.

But issue is(for anonymous user):

On hitting first time this url "[example.com/my-page][1]", REDIRECT SUCCESS!! But on second time it does not redirect. It remains "[example.com/my-page][1]" only.

Now If I logged in, flush all cache, then again log out and check "example.com/my-page", it again works -- REDIRECT SUCCESS!! But again after redirecting first time when accessed the same, it stops redirecting.

  • What code listens for the event? Why is _url_redirect a static function? – Kevin Sep 26 '16 at 15:00
  • Kevin If I write $response = new TrustedRedirectResponse($url); in event itself, then it redirects to homepage. Calling response inside event not allow redirection for authenticated users even. – Sugandh Khanna Sep 28 '16 at 5:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.