Prepare for careersgateway.com.au domain migration
- Update BASE_URL canonical to careersgateway.com.au (OG tags, sitemaps) - Add careersgateway.com.au + www as custom_domains in wrangler.toml - Add www → apex 301 redirect middleware Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
32af32569b
commit
29cfa0b9ac
3 changed files with 18 additions and 1 deletions
11
src/index.js
11
src/index.js
|
|
@ -14,6 +14,17 @@ import {
|
|||
|
||||
const app = new Hono();
|
||||
|
||||
// ── www → apex redirect ──────────────────────────────────────────────────────
|
||||
app.use('*', async (c, next) => {
|
||||
const host = c.req.header('host') || '';
|
||||
if (host.startsWith('www.')) {
|
||||
const url = new URL(c.req.url);
|
||||
url.hostname = url.hostname.replace(/^www\./, '');
|
||||
return c.redirect(url.toString(), 301);
|
||||
}
|
||||
await next();
|
||||
});
|
||||
|
||||
// ── Auth middleware (attaches user to context) ──────────────────────────────
|
||||
app.use('*', async (c, next) => {
|
||||
c.set('user', await getCurrentUser(c.env, c));
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ const CSS = `
|
|||
}
|
||||
`;
|
||||
|
||||
const BASE_URL = 'https://careers.bored.investments';
|
||||
const BASE_URL = 'https://careersgateway.com.au';
|
||||
const DEFAULT_IMAGE = 'https://careersgateway.com.au/wp-content/uploads/2025/06/pexels-photo-1236421-1236421-scaled.jpg';
|
||||
const SITE_NAME = 'Careers Gateway Australia';
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,12 @@ compatibility_flags = ["nodejs_compat"]
|
|||
[[custom_domains]]
|
||||
pattern = "careers.bored.investments"
|
||||
|
||||
[[custom_domains]]
|
||||
pattern = "careersgateway.com.au"
|
||||
|
||||
[[custom_domains]]
|
||||
pattern = "www.careersgateway.com.au"
|
||||
|
||||
[[d1_databases]]
|
||||
binding = "DB"
|
||||
database_name = "careersgateway-db"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue