LoginSignup
0
0

More than 1 year has passed since last update.

【React】next.jsでホームページを設定する方法

Posted at

はじめに

ホームページの設定を自由に出来る方法を調べました。

方法

リダイレクト先を設定する

next.config.jsにて、以下のように設定します。
ホームページにアクセスしたときに、設定したページにリダイレクトされるようになります。

next.config.js
module.exports = {
  async redirects() {
    return [
      {
        source: '/about', //リダイレクト先
        destination: '/', //リダイレクト元
        permanent: true,
      },
    ]
  },
}

Reactを再起動

再起動して、ホームページにアクセスすると、
指定したページにリダイレクトされるようになっています。

参考文献

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0