[ticket/12358] Correctly check and change the redirect url for ajax requests

PHPBB3-12358
Merge remote-tracking branch 'github-nickvergessen/ticket/12358' into develop-ascraeus

* github-nickvergessen/ticket/12358:
  [ticket/12358] Correctly check and change the redirect url for ajax requests