> For the complete documentation index, see [llms.txt](https://liseen315.gitbook.io/laravel/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://liseen315.gitbook.io/laravel/lu-you-yu-kong-zhi-qi/zhong-ding-xiang/redirect-greater-than-to.md).

# redirect()->to()

redirects方法的签名如下:

`function to($to = null, $status = 302, $headers = [], $secure = null)`

$to是一个有效的路径,$status是HTTP状态码(默认302),$header允许你定义与重定向一起发送的HTTP头,$secure允许您覆盖http与https的默认选择（通常根据您当前的请求URL设置),示例3-39显示了其使用示例

{% code title="Example 3-39. redirect()->to()" %}

```php
Route::get('redirect', function () { 
    return redirect()->to('home');
    // Or same, using the shortcut:
    return redirect('home'); 
});
```

{% endcode %}
