1

What is the difference between these two try_files statements and which do you use and why? I've seen both used in tutorials online but cannot find an explanation of the differences or benefits of one over the other.

location / {
  #try_files $uri $uri/ /index.php$is_args$args;
  #try_files $uri $uri/ /index.php?q=$uri&$args;
}
2

As far as I know, WordPress does not require a q= parameter set to the original request (the pretty permalink). So in the second option, the q= parameter will be silently ignored.

According to the Nginx wiki page for WordPress, the query parameters (?$args or $is_args$args) are included:

... so non-default permalinks doesn't break when using query string

I do not know what "non-default permalinks" are, but I just use the following, which works fine with pretty permalinks:

try_files $uri $uri/ /index.php;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.