I am trying to amend my nginx config to redirect from the web root ("/") to /dir-a and then if this returns a 404 redirect to /dir-b. I'm not entirely sure how or if this is possible though.

This is what I have so far...

    location = / {
            rewrite "/" /dir-a permanent;

But this returns the 404 page so I'm not sure where to go from here. I need it to try dir-b instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.