Hi,
In my next.config.js file, I specified redirects for some of my pages. However, when deploying to Netlify, it seems to ignore these redirects. Should I use _redirects
instead so Netlify can acknowledge them?
Here’s what my next.config.js file looks like:
const withBundleAnalyzer = require("@next/bundle-analyzer")({
enabled: process.env.ANALYZE === "true",
});
module.exports = withBundleAnalyzer({
devIndicators: {
autoPrerender: true,
},
images: {
domains: ["dl.airtable.com", "cdn.sanity.io"],
},
webpack: (config, options) => {
config.optimization.minimize = true;
config.optimization.providedExports = true;
config.optimization.usedExports = true;
config.optimization.sideEffects = true;
return config;
},
target: "serverless",
reactStrictMode: true,
async redirects() {
return [
{
source: "/course/",
destination: "/courses",
permanent: true,
},
{
source: "/contact-us/",
destination: "/support/contact-us",
permanent: true,
},
{
source: "/donate",
destination: "https://google.org",
permanent: true,
},
{
source: "/app",
destination: "https://apple.com",
permanent: true,
},
{
source: "/legal/tos",
destination: "/legal/terms-of-service",
permanent: true,
},
];
},
});
Any help would be appreciated, thanks!