rsnext/examples/rewrites/next.config.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

37 lines
757 B
JavaScript
Raw Normal View History

// @ts-check
/**
* @type {import('next').NextConfig}
**/
const nextConfig = {
async rewrites() {
return [
{
source: "/team",
destination: "/about",
},
{
source: "/about-us",
destination: "/about",
},
// Path Matching - will match `/post/a` but not `/post/a/b`
{
source: "/post/:slug",
destination: "/news/:slug",
},
// Wildcard Path Matching - will match `/blog/a` and `/blog/a/b`
{
source: "/blog/:slug*",
destination: "/news/:slug*",
},
// Rewriting to an external URL
{
source: "/docs/:slug",
destination: "http://example.com/docs/:slug",
},
];
},
};
module.exports = nextConfig;