Rewrite / Redirect for 404 Error

I am trying to create a rewrite / redirect block for any 404 response instead of giving a 404 response.

I tried to place rewrite/redir directives inside errors, and I am sure it didn’t work anyhow.


rewrite {
    to {path} {path}/ /404.html # replace /404.html with the path you want.

It lets me rewrite to another file. Is it possible to do a similar redirect directive?

redir /somepath ...

rewrite {
    to {path} {path}/ /somepath

I fixed it this way. Actual problem may turn into XY Problem. So just clearing off dust.

First I had a domain mapped to a Wordpress setup. (

Another one with ( mapped to serve static files,pure HTML (old website)

I tried to redirect if the file is not present on old website. (transparently creating a new website with all new changes without dropping the old site completely.)

Finally, I thought, those HTML files can be moved to a certain directory. like (old). So the old website will be located in
and setup the Wordpress into / (root) directory. Then did a rewrite as follows. Anyhow I had to switch to Nginx for certain consistencies in FCGI connection issues.

rewrite {
     to /old/{path} /old/{path} {path} {path}/ /index.php?url={path};

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.