Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
🚦 Add redirect to support shorter urls (#747)
Luke Vellaa57eb79645c9
diff --git a/apps/landing/next.config.js b/apps/landing/next.config.jsindex 57409a9cb..9fc72959f 100644--- a/apps/landing/next.config.js+++ b/apps/landing/next.config.js@@ -8,6 +8,13 @@ const withBundleAnalyzer = require("@next/bundle-analyzer")({enabled: process.env.ANALYZE === "true",});+const appBaseUrl = process.env.NEXT_PUBLIC_APP_BASE_URL;++function createAppUrl(subpath) {+ const url = new URL(subpath, appBaseUrl);+ return url.href;+}+const nextConfig = {i18n: i18n,productionBrowserSourceMaps: true,@@ -39,32 +46,37 @@ const nextConfig = {},{source: "/p/:path*",- destination: "http://app.rallly.co/p/:path*",+ destination: createAppUrl("/p/:path*"),+ permanent: true,+ },+ {+ source: "/invite/:path*",+ destination: createAppUrl("/invite/:path*"),permanent: true,},{source: "/admin/:path*",- destination: "http://app.rallly.co/admin/:path*",+ destination: createAppUrl("/admin/:path*"),permanent: true,},{source: "/profile",- destination: "http://app.rallly.co",+ destination: createAppUrl(),permanent: true,},{source: "/login",- destination: "http://app.rallly.co/login",+ destination: createAppUrl("/login"),permanent: true,},{source: "/new",- destination: "http://app.rallly.co/new",+ destination: createAppUrl("/new"),permanent: true,},{source: "/register",- destination: "http://app.rallly.co/register",+ destination: createAppUrl("/register"),permanent: true,},];diff --git a/apps/landing/src/lib/linkToApp.ts b/apps/landing/src/lib/linkToApp.tsindex 4526e9885..a02e0386c 100644--- a/apps/landing/src/lib/linkToApp.ts+++ b/apps/landing/src/lib/linkToApp.ts@@ -1,3 +1,4 @@-export const linkToApp = (path?: string) => {- return process.env.NEXT_PUBLIC_APP_BASE_URL + (path ? path : "");+export const linkToApp = (path = "") => {+ const url = new URL(path, process.env.NEXT_PUBLIC_APP_BASE_URL);+ return url.href;};