Files
website/next.config.mjs
T

73 lines
2.3 KiB
JavaScript
Raw Normal View History

2026-04-23 01:08:18 +08:00
import { withPayload } from '@payloadcms/next/withPayload'
import createNextIntlPlugin from 'next-intl/plugin'
const withNextIntl = createNextIntlPlugin('./src/i18n/request.ts')
2026-04-29 14:23:00 +08:00
const PUBLIC_PAGE_CACHE_CONTROL = 'public, max-age=0, s-maxage=300, stale-while-revalidate=86400'
2026-04-23 01:08:18 +08:00
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
distDir: process.env.NEXT_DIST_DIR || '.next',
images: {
formats: ['image/avif', 'image/webp'],
remotePatterns: [
{ protocol: 'https', hostname: 'www.eversolo.com' },
{ protocol: 'https', hostname: 'eversolo.com' },
],
},
async redirects() {
// Legacy URL -> new URL map. Edit REDIRECTS.md for the authoritative list.
return [
// Locale entry points
{ source: '/Index/index/l/en-us.html', destination: '/en', permanent: true },
{ source: '/Index/index/l/zh-cn.html', destination: '/zh', permanent: true },
// Header / top nav
{ source: '/Product/allProduct.html', destination: '/en/products', permanent: true },
{ source: '/Support/support.html', destination: '/en/support', permanent: true },
{ source: '/Support/downloads.html', destination: '/en/downloads', permanent: true },
{ source: '/About/index.html', destination: '/en/about', permanent: true },
// Footer / secondary
{ source: '/Contact/afterservice.html', destination: '/en/support/warranty', permanent: true },
2026-04-29 14:23:00 +08:00
{ source: '/Contact/distributor.html', destination: '/en/where-to-buy', permanent: true },
2026-04-23 01:08:18 +08:00
{ source: '/Contact/oem.html', destination: '/en/support/contact', permanent: true },
]
},
2026-04-29 14:23:00 +08:00
async headers() {
return [
{
source: '/:locale(en|zh)',
headers: [
{
key: 'Cache-Control',
value: PUBLIC_PAGE_CACHE_CONTROL,
},
],
},
{
source: '/:locale(en|zh)/:path*',
headers: [
{
key: 'Cache-Control',
value: PUBLIC_PAGE_CACHE_CONTROL,
},
],
},
{
source: '/sitemap.xml',
headers: [
{
key: 'Cache-Control',
value: PUBLIC_PAGE_CACHE_CONTROL,
},
],
},
]
},
2026-04-23 01:08:18 +08:00
}
export default withNextIntl(withPayload(nextConfig))