$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>virtual hosts - Difference between these two nginx try_files statements for WordPress?|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

virtual hosts - Difference between these two nginx try_files statements for WordPress?

matteradmin8PV0评论

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;
}

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;
}
Share Improve this question asked Nov 3, 2018 at 14:33 PaulPaul 3802 silver badges9 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 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;
Post a comment

comment list (0)

  1. No comments so far