next.config.ts 652 B

12345678910111213141516171819202122232425262728
  1. import type { NextConfig } from "next"
  2. const nextConfig: NextConfig = {
  3. webpack: (config) => {
  4. config.resolve.extensionAlias = { ".js": [".ts", ".tsx", ".js", ".jsx"] }
  5. return config
  6. },
  7. async redirects() {
  8. return [
  9. // Redirect www to non-www
  10. {
  11. source: "/:path*",
  12. has: [{ type: "host", value: "www.roocode.com" }],
  13. destination: "https://roocode.com/:path*",
  14. permanent: true,
  15. },
  16. // Redirect HTTP to HTTPS
  17. {
  18. source: "/:path*",
  19. has: [{ type: "header", key: "x-forwarded-proto", value: "http" }],
  20. destination: "https://roocode.com/:path*",
  21. permanent: true,
  22. },
  23. ]
  24. },
  25. }
  26. export default nextConfig