# res.redirect

重定向到从指定 path 派生的 URL。

# 概要

res.redirect([status,] path)

# 描述

重定向到从指定 path 派生的 URL,指定 status,一个对应于 HTTP 状态码 的正整数。如果未指定,则 status 默认为 "302 "Found”。

res.redirect('/foo/bar')
res.redirect('http://example.com')
res.redirect(301, 'http://example.com')
res.redirect('../login')

重定向可以是用于重定向到不同站点的完全限定 URL:

+

关注公众号,获取验证码 !

验证码:
Last Updated: 6/17/2023, 6:57:19 PM