Skip to content

Rewrite rule for root path "/" #61808

Answered by icyJoseph
bledari asked this question in Help
Discussion options

You must be logged in to vote

Hi,

I tried with:

/** @type {import('next').NextConfig} */
const nextConfig = {
  async rewrites() {
    return {
      beforeFiles: [{ source: "/", destination: "https://example.com" }],
    };
  },
};

export default nextConfig;

And it works, the / goes to example, and other routes take me to the Next.js page.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@bledari
Comment options

Answer selected by bledari
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants