Index fallback?

Edho Arief me at myconan.net
Mon Oct 10 06:19:15 UTC 2016


Made a bit more compact but still using ifs.

location / {
    location ~ /$ {
        error_page 418 = @dirlist;

        if (-d $request_filename) {
            set $index_fallback A;
        }

        if (!-f $request_filename/index.html) {
            set $index_fallback "${index_fallback}B";
        }

        if ($index_fallback = AB) {
            return 418;
        }
    }
}

On Mon, Oct 10, 2016, at 15:08, Edho Arief wrote:
> Hi,
> 
> On Mon, Oct 10, 2016, at 12:56, Edho Arief wrote:
> > I somehow can't make this scenario work:
> > 
> > root structure:
> > /a/index.html
> > /b/ <-- no index.html
> > 
> > accessing:
> > 1. site.com/a -> redirect to site.com/a/ -> show /a/index.html
> > 2. site.com/b -> redirect to site.com/b/ -> show @fallback
> > 
> > 
> 



More information about the nginx mailing list