Next.js Discord

Discord Forum

rewrite the url nextConfig

Unanswered
Lesser Scaup posted this in #help-forum
Open in Discord
Lesser ScaupOP
i want to change the url to add .html to them, im also using next-intl for translation, the image shows the structure if the project,
i followed the docs however it's not working,
does someone know how to fix it or what im doing wrong?
import type { NextConfig } from 'next';
import createNextIntlPlugin from 'next-intl/plugin';

const withNextIntl = createNextIntlPlugin('./i18n/request.ts');

const nextConfig: NextConfig = {
    /* config options here */
    // rewrites: async () => {
    //     return [
    //         {
    //             source: '/todo.html',
    //             destination: '/driver',
    //         },
    //     ];
    // },
    rewrites: async () => {
        return [
            {
                source: '/driver.html',
                destination: '/driver',
            },
            {
                source: '/petrolstations.html',
                destination: '/petrolstations',
            },
            {
                source: '/aboutus.html',
                destination: '/aboutus',
            },
            {
                source: '/news.html',
                destination: '/news',
            },
            {
                source: '/contact.html',
                destination: '/contact',
            }
        ];
    },
};
export default withNextIntl(nextConfig);

0 Replies