Handling redirects with Koa

In Koa.js framework, you can make redirect using the .redirect() method of context object:

The status of this redirect will be 302:

302 redirect in Koa
302 redirect in Koa

A 301 redirect you can create using the next way:

301 redirect in Koa framework
301 redirect in Koa framework

You can pass to method the next values:

  • absolute path
  • absolute URL
  • relative path
  • ..

If you liked this, please help spread the word by hitting the recommend button below. Thanks!