RedirectController
in package
Redirects a request to another URL.
Tags
Table of Contents
- $httpPort : mixed
- $httpsPort : mixed
- $router : mixed
- __construct() : mixed
- __invoke() : Response
- redirectAction() : Response
- Redirects to another route with the given name.
- urlRedirectAction() : Response
- Redirects to a URL.
Properties
$httpPort
private
mixed
$httpPort
$httpsPort
private
mixed
$httpsPort
$router
private
mixed
$router
Methods
__construct()
public
__construct([UrlGeneratorInterface|null $router = null ][, int|null $httpPort = null ][, int|null $httpsPort = null ]) : mixed
Parameters
- $router : UrlGeneratorInterface|null = null
- $httpPort : int|null = null
- $httpsPort : int|null = null
Return values
mixed —__invoke()
public
__invoke(Request $request) : Response
Parameters
- $request : Request
Return values
Response —redirectAction()
Redirects to another route with the given name.
public
redirectAction(Request $request, string $route[, bool $permanent = false ][, bool|array<string|int, mixed> $ignoreAttributes = false ][, bool $keepRequestMethod = false ][, bool $keepQueryParams = false ]) : Response
The response status code is 302 if the permanent parameter is false (default), and 301 if the redirection is permanent.
In case the route name is empty, the status code will be 404 when permanent is false and 410 otherwise.
Parameters
- $request : Request
- $route : string
-
The route name to redirect to
- $permanent : bool = false
-
Whether the redirection is permanent
- $ignoreAttributes : bool|array<string|int, mixed> = false
-
Whether to ignore attributes or an array of attributes to ignore
- $keepRequestMethod : bool = false
-
Whether redirect action should keep HTTP request method
- $keepQueryParams : bool = false
Tags
Return values
Response —urlRedirectAction()
Redirects to a URL.
public
urlRedirectAction(Request $request, string $path[, bool $permanent = false ][, string|null $scheme = null ][, int|null $httpPort = null ][, int|null $httpsPort = null ][, bool $keepRequestMethod = false ]) : Response
The response status code is 302 if the permanent parameter is false (default), and 301 if the redirection is permanent.
In case the path is empty, the status code will be 404 when permanent is false and 410 otherwise.
Parameters
- $request : Request
- $path : string
-
The absolute path or URL to redirect to
- $permanent : bool = false
-
Whether the redirect is permanent or not
- $scheme : string|null = null
-
The URL scheme (null to keep the current one)
- $httpPort : int|null = null
-
The HTTP port (null to keep the current one for the same scheme or the default configured port)
- $httpsPort : int|null = null
-
The HTTPS port (null to keep the current one for the same scheme or the default configured port)
- $keepRequestMethod : bool = false
-
Whether redirect action should keep HTTP request method