<div dir="ltr">Hi<br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 10, 2016 at 1:19 PM, Edho Arief <span dir="ltr"><<a href="mailto:me@myconan.net" target="_blank">me@myconan.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Made a bit more compact but still using ifs.<br>
<br>
location / {<br>
    location ~ /$ {<br>
        error_page 418 = @dirlist;<br>
<br>
        if (-d $request_filename) {<br>
            set $index_fallback A;<br>
        }<br>
<br>
        if (!-f $request_filename/index.html) {<br>
            set $index_fallback "${index_fallback}B";<br>
        }<br>
<br>
        if ($index_fallback = AB) {<br>
            return 418;<br>
<span class="gmail-im gmail-HOEnZb">        }<br>
    }<br>
}<br>
<br>
On Mon, Oct 10, 2016, at 15:08, Edho Arief wrote:<br>
> Hi,<br>
><br>
> On Mon, Oct 10, 2016, at 12:56, Edho Arief wrote:<br>
> > I somehow can't make this scenario work:<br>
> ><br>
> > root structure:<br>
> > /a/index.html<br>
> > /b/ <-- no index.html<br>
> ><br>
> > accessing:<br>
> > 1. <a href="http://site.com/a" rel="noreferrer" target="_blank">site.com/a</a> -> redirect to <a href="http://site.com/a/" rel="noreferrer" target="_blank">site.com/a/</a> -> show /a/index.html<br>
> > 2. <a href="http://site.com/b" rel="noreferrer" target="_blank">site.com/b</a> -> redirect to <a href="http://site.com/b/" rel="noreferrer" target="_blank">site.com/b/</a> -> show @fallback<br>
> ><br>
> ><br>
><br>
<br>
</span><div class="gmail-HOEnZb"><div class="gmail-h5">______________________________<wbr>_________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer" target="_blank">http://mailman.nginx.org/<wbr>mailman/listinfo/nginx</a><br>
</div></div></blockquote></div><br></div><div class="gmail_extra">Still need more locations, but independent to directories you want to access:<br><br><font face="monospace,monospace"><br>    server {<br>            listen 7770;<br>            root /tmp;<br>            autoindex on;<br>            autoindex_format json;<br>    }<br><br>    server {<br>            listen       80;<br>            server_name  localhost;<br>            index index.html;<br>            root /tmp;<br><br>            location ~ /.*?[^/]$ {<br>                    try_files $uri @redir;<br>            }<br><br>            location @redir {<br>                    return 301 $uri/;<br>            }<br><br>            location ~ /$ {<br>                    try_files $uri"index.html" @reproxy;<br>            }<br><br>            location @reproxy {<br>                    proxy_pass <a href="http://localhost:7770">http://localhost:7770</a>;<br>            }<br>    }<br></font><br clear="all"></div><div class="gmail_extra"><br>-- <br><div class="gmail_signature">regards,<br>Nurahmadie<br>--<br></div>
</div></div>