How are you doing?
I will try to make this as simple as possible:
I have a HTML called users.html
. That HTML contains a JS script that fetches a user’s information on the server. It gets the username using the URL. For example:
webpage.com/users/kibebr
or webpage.com/users.html/kibebr
the JS script reads the kibebr
and fetches the data.
It’s working great on my computer but how can I use Netlify redirects to achieve the same?
I have tried:
[[redirects]]
from = "/users/*"
to = "/users"
status = 200
force = false
headers = {X-From = "Netlify"}
When I go to webpage.com/users
the server rejects it, works fine!
However, when I add a slash like webpage.com/users/kibebr
, I get
Uncaught SyntaxError: Unexpected token '<'
NOTE: I do have a web app running with the issue, you can see it with:
https://pixelsketch.netlify.app/users
https://pixelsketch.netlify.app/users/username