I have a Gatsby site which loads a front-end script. This script is some auction software which loads pages in via #! urls
I see lots of traffic from URLs like… https://www.apexauctions.co.uk/#!/itemDetails/419/37888 (it’s missing the word auction from inside the URL)
I’ve set up a redirect in my TOML file…
from = “/#!/*”
to = “/auction/#!/:splat”
status = 301
force = true
How can I get around this with Netlify? I’ve tried TOML, _redirects and Gatsby’s createRedirect() with no luck at all.
Is the only way to use a Netlify Edge Function or is there a simpler way?
If Netlify edge functions are needed, then what is the best way to handle these splats in Netlify edge?
March 27, 2023, 6:09pm
hi there, I strongly suggest you give it a thorough read through and see if this fixes your problem:
Last Reviewed By Netlify Support Staff December 2022
You’ve put blood, sweat and tears into building an incredible static site with all the bells and whistles. However, you’ve configured some redirect rules and you’ve come unstuck… they don’t appear to be working!
Ensure you’ve followed the correct guidance
Our redirects and rewrites document covers a broad range of use cases, from status codes to proxying another service and everything in between.
Ensure you’re using the corr…
You definitely do not have to use edge functions to set up your redirect.
It is because a
# symbol is interpreted by the browser, so the Netlify redirect engine is never aware of it. This is a fundamental part of how the WWW/HTML/etc. works.
See this answer on stack overflow
If you need/want to handle an
# in a URL as explained
pathname etc. and redirect accordingly.