go.componentowl.com redirect Worker

This commit is contained in:
Jarvis Prime
2026-03-23 16:58:20 +00:00
commit f369d644fb
2 changed files with 21 additions and 0 deletions

14
src/index.js Normal file
View File

@@ -0,0 +1,14 @@
const REDIRECTS = {
'blv-tech-comparison': 'http://www.componentowl.com/quick-start-guide/better-listview/data/chapter-appendix-matrix.html',
};
const HOME = 'https://www.componentowl.com';
export default {
async fetch(request) {
const url = new URL(request.url);
const path = url.pathname.replace(/^\//, '').replace(/\/$/, '');
const dest = REDIRECTS[path] || HOME;
const qs = url.search || '';
return Response.redirect(dest + qs, 302);
}
};

7
wrangler.toml Normal file
View File

@@ -0,0 +1,7 @@
name = "cowl-redirects"
main = "src/index.js"
compatibility_date = "2024-01-01"
workers_dev = true
routes = [
{ pattern = "go.componentowl.com/*", zone_name = "componentowl.com" }
]