I have a question and couldn't find a solution for it.
We have a Wordpress page where the client wants multiple error pages.
1 error page is in the usual normal 404.php for the custom theme which we created. Now I want to add multiple error pages with different styling and html structure.
example:
localhost/blog/{post-name} -> if post-name is not found load me the post-404-error.php
localhost/service/{service-name} -> if service-name was not found load the service-404-error.php
I couldn't think of a good solution how to get it done the right and save way.
I thought about changing the .htaccess like described here: https://stackoverflow.com/questions/24198493/404-redirection-to-multiple-error-page-htaccess
But if permalinks are saved the .htaccess is rewritten and my changes will be gone there. Also I didn't know how to put the correct error documents inside (my rewriting htaccess knowledge is not the best.) I thought there could be a coded way with php/js something?
I also thought about some complicated check if this url is called and then check if is_404() but I guess its too complicated.
Thanks in advance for any help and tips :)
.htaccessanyway (Apache'sErrorDocumentis not going to help here). The question you've linked to on StackOverflow is not using WordPress (and the SO question / answer are ambiguous/incorrect for a number of reasons).