Redirect for Next JS App

Posted on: March 4th, 2026
By: Tadeo Martinez

Here’s how to create the nextjs app

npx create-next-app@latest

Edit the next.config.ts

const nextConfig: NextConfig = {
  async redirects() {
    return [
      {
        source: "/:path*",
        destination: "https://domainname.com/:path*",
        permanent: true,
      },
    ];
  },
};

The file will look like the below originally:

import type { NextConfig } from "next";

const nextConfig: NextConfig = {
  /* config options here */
};

export default nextConfig;

Have any questions or comments? Write them below!


Leave a Reply

Your email address will not be published. Required fields are marked *