Nginx v 1.4.6
autoindex off;
In an application having no central routing end-point, and for directories w/in the structure that have no index.* at all, I want to external redirect rather than 403 Forbidden or internal redirect.
app-root/
app-core/
config/
lib/
modules/
templates/
index.php
Given the above, if none of app-core/ lib/ modules/ templates/ have an index.*, with no server { location {}}
configuration coverage, any request to them results in a 402 forbidden response. Yucky.
With this config, I can internally redirect to an actual index.
location ~* ^/(app-core|config|lib|modules|templates)/$ {
index /;
}
So an request to http://localhost:xxxx/lib/
serves the app-root/index.php shown above. Fair enough but I think it could be better.
I would rather issue a 303 See Other and redirect to http://localhost:xxxx/
but I cannot figure out how to make it work.