I want to rewrite all requests to /index.php
, except /css/*
and /js/*
.
This is my original config
location / {
try_files $uri /index.php$is_args$args;
}
which works, but lets me access all files directly. I tried this
location / {
rewrite ^(.+)$ /index.php break;
}
but couldn't get past weird errors like PHP parsing breaking. After I get /index.php
rewrite working I assume I should do something like location /css/ { .. }
etc, but I'm not really sure.
Any idea how to solve this? Thanks.
Actually found an answer right after I posted this question.
The trick seemed to be to put the php
location
above the other ones.