Skip to content

Commit 393f3d3

Browse files
committed
Redirect old domain to canonical .ai host
1 parent 30c055e commit 393f3d3

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

apps/docs/middleware.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,16 @@ function getPreferredLanguage(request: NextRequest): string {
8787
* - Stores language preference as a cookie
8888
*/
8989
export default function middleware(request: NextRequest) {
90+
// Canonical domain redirect: www.objectos.app -> www.objectos.ai (permanent).
91+
const host = request.headers.get('host');
92+
if (host === 'www.objectos.app') {
93+
const target = new URL(request.url);
94+
target.protocol = 'https:';
95+
target.host = 'www.objectos.ai';
96+
target.port = '';
97+
return NextResponse.redirect(target, 308);
98+
}
99+
90100
const { pathname } = request.nextUrl;
91101

92102
// Check if the pathname already has a locale

apps/docs/wrangler.jsonc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"enabled": true
1616
},
1717
"routes": [
18-
{ "pattern": "www.objectos.app", "custom_domain": true },
19-
{ "pattern": "www.objectos.ai", "custom_domain": true }
18+
{ "pattern": "www.objectos.ai", "custom_domain": true },
19+
{ "pattern": "www.objectos.ai/*", "zone_name": "objectos.ai" },
20+
{ "pattern": "www.objectos.app/*", "zone_name": "objectos.app" }
2021
]
2122
}

0 commit comments

Comments
 (0)