cakephp-2.0 > Router :: redirect()
Router
- _handleNoRoute
- _parseExtension
- _setPrefixes
- ¤tRoute
- &requestRoute
- connect
- connectNamed
- extensions
- getNamedExpressions
- getParam
- getParams
- getPaths
- getRequest
- mapResources
- namedConfig
- normalize
- parse
- parseExtensions
- popRequest
- prefixes
- promote
- queryString
- redirect
- reload
- reverse
- setRequestInfo
- stripPlugin
- url
A
AbstractTransport
AclBehavior
AclComponent
AclInterface
AclNode
AclShell
Aco
AcoAction
ActionsAuthorize
ApcEngine
ApiShell
App
AppController
AppController
AppHelper
AppHelper
AppModel
AppModel
AppShell
Aro
AuthComponent
B
BadRequestException
BakeShell
BakeTask
BaseAuthenticate
BaseAuthorize
BasicAuthenticate
BasicAuthentication
BehaviorCollection
C
Cache
CacheEngine
CacheException
CacheHelper
CacheSession
CakeEmail
CakeErrorController
CakeException
CakeLog
CakeLogException
CakeLogInterface
CakePlugin
CakeRequest
CakeResponse
CakeRoute
CakeSchema
CakeSession
CakeSessionException
CakeSessionHandlerInterface
CakeSocket
ClassRegistry
CommandListShell
Component
ComponentCollection
ConfigReaderInterface
Configure
ConfigureException
ConnectionManager
ConsoleErrorHandler
ConsoleException
ConsoleInput
ConsoleInputArgument
ConsoleInputOption
ConsoleInputSubcommand
ConsoleOptionParser
ConsoleOutput
ConsoleShell
ContainableBehavior
Controller
ControllerAuthorize
ControllerTask
CookieComponent
CrudAuthorize
D
DatabaseSession
DataSource
DbAcl
DbAclSchema
DbConfigTask
DboSource
Debugger
DebugTransport
DigestAuthenticate
DigestAuthentication
Dispatcher
E
EmailComponent
ErrorHandler
ExceptionRenderer
ExtractTask
F
File
FileEngine
FileLog
FixtureTask
Folder
ForbiddenException
FormAuthenticate
FormHelper
H
Helper
HelperCollection
HelpFormatter
HtmlHelper
HttpException
HttpResponse
HttpSocket
I
I18n
I18nModel
i18nSchema
I18nShell
Inflector
IniReader
InternalErrorException
J
JqueryEngineHelper
JsBaseEngineHelper
JsHelper
L
L10n
M
MailTransport
MediaView
MemcacheEngine
MethodNotAllowedException
MissingActionException
MissingBehaviorException
MissingComponentException
MissingConnectionException
MissingControllerException
MissingDatabaseException
MissingDatasourceConfigException
MissingDatasourceException
MissingHelperException
MissingLayoutException
MissingModelException
MissingPluginException
MissingShellException
MissingShellMethodException
MissingTableException
MissingTaskException
MissingTestLoaderException
MissingViewException
Model
ModelBehavior
ModelTask
MootoolsEngineHelper
Multibyte
Mysql
N
NotFoundException
NumberHelper
O
Object
ObjectCollection
P
PagesController
PagesController
PaginatorComponent
PaginatorHelper
Permission
PhpReader
PluginShortRoute
PluginTask
Postgres
PrivateActionException
ProjectTask
PrototypeEngineHelper
R
RedirectRoute
RequestHandlerComponent
Router
RouterException
RssHelper
S
Sanitize
Scaffold
ScaffoldView
SchemaShell
Security
SecurityComponent
SessionComponent
SessionHelper
SessionsSchema
Set
Shell
ShellDispatcher
SmtpTransport
SocketException
Sqlite
Sqlserver
String
T
TaskCollection
TemplateTask
TestsuiteShell
TestTask
TextHelper
ThemeView
TimeHelper
TranslateBehavior
TreeBehavior
U
UnauthorizedException
UpgradeShell
V
Validation
View
ViewTask
W
WincacheEngine
X
XcacheEngine
Xml
XmlException
redirect
line:295 at
/lib/Cake/Routing/Router.php
Connects a new redirection Route in the router.
Method
(array)
public redirect
($route, $url, $options = array())
Parameters
Parameter | Type | Comment | Default |
---|---|---|---|
$route | string | required A string describing the template of the route | |
$url | array | required A url to redirect to. Can be a string or a Cake array-based url | |
$options | array | optional An array matching the named elements in the route to regular expressions which that element should match. Also contains additional parameters such as which routed parameters should be shifted into the passed arguments. As well as supplying patterns for routing parameters. | array() |
Return
arrayComment
Connects a new redirection Route in the router.
Redirection routes are different from normal routes as they perform an actual
header redirection if a match is found. The redirection can occur within your
application or redirect to an outside location.
Examples:
`Router::redirect('/home/*', array('controller' => 'posts', 'action' => 'view', array('persist' => true));`
Redirects /home/* to /posts/view and passes the parameters to /posts/view. Using an array as the
redirect destination allows you to use other routes to define where a url string should be redirected to.
`Router::redirect('/posts/*', 'http://google.com', array('status' => 302));`
Redirects /posts/* to http://google.com with a HTTP status of 302
### Options:
- `status` Sets the HTTP status (default 301)
- `persist` Passes the params to the redirected route, if it can. This is useful with greedy routes,
routes that end in `*` are greedy. As you can remap urls and not loose any passed/named args.
@param string $route A string describing the template of the route
@param array $url A url to redirect to. Can be a string or a Cake array-based url
@param array $options An array matching the named elements in the route to regular expressions which that
element should match. Also contains additional parameters such as which routed parameters should be
shifted into the passed arguments. As well as supplying patterns for routing parameters.
@see routes
@return array Array of routes
Redirection routes are different from normal routes as they perform an actual
header redirection if a match is found. The redirection can occur within your
application or redirect to an outside location.
Examples:
`Router::redirect('/home/*', array('controller' => 'posts', 'action' => 'view', array('persist' => true));`
Redirects /home/* to /posts/view and passes the parameters to /posts/view. Using an array as the
redirect destination allows you to use other routes to define where a url string should be redirected to.
`Router::redirect('/posts/*', 'http://google.com', array('status' => 302));`
Redirects /posts/* to http://google.com with a HTTP status of 302
### Options:
- `status` Sets the HTTP status (default 301)
- `persist` Passes the params to the redirected route, if it can. This is useful with greedy routes,
routes that end in `*` are greedy. As you can remap urls and not loose any passed/named args.
@param string $route A string describing the template of the route
@param array $url A url to redirect to. Can be a string or a Cake array-based url
@param array $options An array matching the named elements in the route to regular expressions which that
element should match. Also contains additional parameters such as which routed parameters should be
shifted into the passed arguments. As well as supplying patterns for routing parameters.
@see routes
@return array Array of routes