K
K
kirillleogky2021-07-02 11:24:23
JavaScript
kirillleogky, 2021-07-02 11:24:23

How to add a 301 redirect to Next.js?

How to add a redirect from http to https in Next.js 301?
Example - -

из этого "http://stackoverflow.com/" в "https://stackoverflow.com/" ?


this option doesn't work:
res.writeHead(301, { Location: `https://${req?.headers.host}/${asPath}` })

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question