But
That script also moves the 404.html page which sort of breaks things. Netlify will build and deploy, but when users hit a route that doesn’t exist, they don’t get my website’s 404 they get Netlify’s generic 404.
I’ve Tried and didn’t work
Updating the script to move all but the 404.html.
Update the script to move all files then cd back into the /pathname/ directory and move the 404.html back up to the public/ directory.
This seems all wrong for what I want to do
I sense for what I want to do I’m going about this all wrong.
It sounds like you could add a redirect rule to forward any paths that result in a 404 to a different URL, see the docs for more information: Redirect options | Netlify Docs
In your case, you might be able to redirect /* to /pathname/404.
The implication is that your WordPress hosting company will not allow you to upload separate content via SFTP. If that is not the case, you could host your static files in a folder alongside your WordPress files.
@gregraven, yeah. This is an option, but I really want it to be my last option. I really really don’t want to leave the performance and netlify functions of Netlify.
Hey Josh - Sander’s suggestion may indeed work for you, though it will not return a 404 but instead a 301 to the 404 page. Still should show the content you want though
The usual suggestion is to proxy from Netlify to the other site, but that wouldn’t work super well for a custom 404, or rather, you could use the 404 only for assets in /example/* using a pattern like Sander’s with the caveat that a) it would be a 301 redirect, not a 404 error as I mentioned and b) you’d probably want to let wordpress server handle the 404’s for anything not in /pathname…
Sorry, I can’t give specifics. Not that it is top secret or anything, it’s just that I don’t know. I asked, Pagely, my hosting service for WordPress and where my domain is used to do it. Basically, I called in a support ticket and they did it all.
Sorry, I get a little over my head doing that kind of DevOpsy stuff. I know when I asked that had something already chambered and ready to go so I don’t think it was a big task for them.