Skip to content

Commit

Permalink
Merge pull request #640 from 1ifeworld/0xTranqui/redirect-3
Browse files Browse the repository at this point in the history
plz
  • Loading branch information
0xTranqui authored Nov 6, 2024
2 parents b198e03 + 002b38e commit b241465
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions apps/site/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import type { NextRequest } from 'next/server';
export function middleware(request: NextRequest) {
const url = new URL(request.url);

console.log("incoming url: ", url)

// Redirect users visiting river.ph to river.site
if (url.hostname === 'river.ph') {
if (
url.hostname === 'river.ph'
|| url.hostname === 'www.river.ph'
|| request.nextUrl.hostname === 'river.ph'
|| request.nextUrl.hostname === 'www.river.ph'
) {
url.hostname = 'river.site';
console.log("outgoing url: ", url)
return NextResponse.redirect(url);

}
Expand Down

0 comments on commit b241465

Please sign in to comment.