go.componentowl.com redirect Worker
This commit is contained in:
14
src/index.js
Normal file
14
src/index.js
Normal 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
7
wrangler.toml
Normal 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" }
|
||||||
|
]
|
||||||
Reference in New Issue
Block a user