404 page get original requested path

Site URL: https://blix-it.netlify.app/

I have page-not-founds working fine, and they are displaying the 404.html page correctly.

Is there any way to get the original URL/path requested before the redirect happened?
Either on the 404 page itself or do the work inside the netlify.toml redirects file?

Thanks in advance,

Hi @Adrian_Parr,

Netlify doesn’t change the address in the URL bar when redirecting for a 404. So you could use location.href in client-side JS to see what page was requested that returned the 404.

OMG, of course! I hadn’t even noticed that. Duh!

Many thanks hrishikesh :+1: