File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ /**
2+ * 301 redirect from the legacy applirank.com domain to reqcore.com.
3+ *
4+ * If the old domain's DNS still points to this server (via Cloudflare or Railway),
5+ * this middleware redirects all traffic to the new domain with a permanent 301,
6+ * preserving the original path and query string so Google transfers link equity.
7+ *
8+ * Also handles non-www → www normalization if ever needed, and ensures HTTPS.
9+ */
10+ const LEGACY_HOSTS = new Set ( [ 'applirank.com' , 'www.applirank.com' ] )
11+ const CANONICAL_ORIGIN = 'https://reqcore.com'
12+
13+ export default defineEventHandler ( ( event ) => {
14+ const host = getRequestHeader ( event , 'host' ) ?. split ( ':' ) [ 0 ] ?. toLowerCase ( )
15+ if ( ! host || ! LEGACY_HOSTS . has ( host ) ) return
16+
17+ const url = getRequestURL ( event )
18+ const target = `${ CANONICAL_ORIGIN } ${ url . pathname } ${ url . search } `
19+
20+ return sendRedirect ( event , target , 301 )
21+ } )
You can’t perform that action at this time.
0 commit comments