Redirect examples - Drupal 8
Ex : use Symfony \ Component \ HttpFoundation \ RedirectResponse ; // Redirect to specific route or URL. return new RedirectResponse ( \ Drupal :: url ( 'user.page' ) ) ; return new RedirectResponse ( \ Drupal :: url ( 'locale.translate_status' , [ ] , [ 'absolute' = > TRUE ] ) ) ; return new RedirectResponse ( \ Drupal :: url ( '<front>' , [ ] , [ 'absolute' = > TRUE ] ) ) ; return new RedirectResponse ( Url :: fromRoute ( 'system.modules_uninstall' ) - > setAbsolute ( ) - > toString ( ) ) ; return new RedirectResponse ( Url :: fromRoute ( '<current>' ) - > toString ( ) ) ; // Redirect to external URL. use Drupal \ Core \ Routing \ TrustedRedirectResponse ; return new TrustedRedirectResponse ( 'http://www.google.com/' ) ; // If you have extended ControllerBase class or use Drupal\Core\Routing\UrlGeneratorTrait; return $this - > redirect ( '...