Page Contents
  
 
    
Home > @loopback/rest > RestServer > redirect
RestServer.redirect() method
Register a route redirecting callers to a different URL.
Signature:
redirect(fromPath: string, toPathOrUrl: string, statusCode?: number): Binding;
Parameters
| Parameter | Type | Description | 
|---|---|---|
| fromPath | string | URL path of the redirect endpoint | 
| toPathOrUrl | string | Location (URL path or full URL) where to redirect to. If your server is configured with a custom `basePath`, then the base path is prepended to the target location. | 
| statusCode | number | _(Optional)_ HTTP status code to respond with, defaults to 303 (See Other). | 
Returns:
Example
server.redirect('/explorer', '/explorer/');