I’m building a static html css and js site, and I’m essentially using Vercel rewrites to do stuff like this:
getbrandkit.com/b/brandkit, should be given to the JavaScript as getbrandkit.com/b/main.html?b=brandkit. BUT, I never want the user to see the url parameters in their URL bar.
getbrandkit.com/b/brandkit is NOT an existent file in my code.
I’m using Vercel rewrites:
{
"rewrites": [
{
"source": "/b/:b",
"destination": "/b/main.html?b=:b"
}
]
}
^^ This is clearly doing something because it is loading main.html when I visit getbrandkit.com/b/brandkit
, but, I’m not able to get the b value using URL parameters, unless I physically type, getbrandkit.com/b/main.html?b=brandkit
.
Ultimately, going to: getbrandkit.com/b/brandkit should console.log brandkit, and getbrandkit.com/b/anything should console.log anything.
TLDR: How do I get the value from getbrandkit.com/b/ANYTHING, on a serverless site, even though the file doesn’t exist.