Reputation: 4689
I have a folder /assets
which contains files like index.hml
, css/*
, js/*
, etc.
Here is what I want to accomplish:
/
or index.html
server index.html
css/main.css
, etc)I also need query params ($args
) to be passed through
Here is my enginx partial configuration:
location / {
root /assets;
try_files $uri $uri/index.html$is_args$args =404;
}
With this settings I get the following results:
domain.com/css/main.css
> 200: domain.com/css/main.css
domain.com/index.html
> 200: domain.com/index.html
domain.com/
> 200: (renders same as domain.com/index.html)
domain.com/index.html?q=x
> 200: domain.com/index.html?q=x
domain.com/?q=x
> 404: Not Found
What do I have to change to have domain.com/?q=x
to return the same response as domain.com/index.html?q=x
instead of not 404
Upvotes: 1
Views: 2986
Reputation: 4689
The proposed answer by @richard-smith solved it
location / {
root /assets;
index index.html;
try_files $uri $uri/ =404;
Upvotes: 1