Nginx v 1.4.6
autoindexclosures;
在没有中心路由端点的应用程序中,对于没有索引*的结构中的目录,我想要外部redirect,而不是403 Forbidden或内部redirect。
app-root/ app-core/ config/ lib/ modules/ templates/ index.php
鉴于上述情况,如果没有任何app-core / lib / modules / templates /具有索引*,且没有server { location {}}configuration覆盖,则对它们的任何请求都会导致402禁止响应。 令人讨厌。
有了这个configuration,我可以在内部redirect到一个实际的索引。
location ~* ^/(app-core|config|lib|modules|templates)/$ { index /; }
因此,对http://localhost:xxxx/lib/的请求将服务于上面显示的app-root / index.php。 够公平的,但我认为这可能会更好。
我宁愿发出一个303 见其他和redirect到http://localhost:xxxx/但我不知道如何使其工作。
它应该与这个工作:
location ~* ^/(app-core|config|lib|modules|templates)/$ { return 303 http://localhost:xxxx/; }