I also tried this using a complete url for my site. That did not work either. It works fine if I redirect to an actual page on my site, however, just not if I want to redirect to the 404 page.
It depends.
If you created your own custom 404 page , you can use your code exactly as you wrote it.
Otherwise, you’ll have to use the full URL (and not the relative path). In that case it will refresh the page (meaning, it will empty the memory. So maybe consider creating your own 404).
(and maybe consider to do it with a router instead of wixLocation. depends on your needs).
If it’s a router page, you can make the redirection before the page gets rendered. As for performance, I can’t say if router page is slower or not (I never made a thorough test).